/* ============================================================
   合记 · 多门店经营协同系统
   原创视觉体系 — 深青绿主色 / 琥珀强调 / 扁平高对比
   ============================================================ */

:root {
  /* 主色：从「墨青」提到「翠青」。同色相下提高饱和与明度。
     分层约定：
       --brand        承载白字的「可用色」，压到 #15846E（白字/白底双向 4.6:1）
       --brand-bright 纯装饰（渐变端、大面积色块），可以更亮更艳
       --brand-ink    浅底上的正文色
     两者拆开，既保住「靓丽」，又不牺牲可读性。 */
  --brand:        #15846E;
  --brand-bright: #0BA88E;   /* 装饰专用：白字压不住，只做背景/渐变 */
  --brand-dark:   #0E6B59;
  --brand-ink:    #06685A;   /* 浅底上的正文色，保证可读性 */
  --brand-light:  #DCF7F0;
  --brand-soft:   #F2FCF9;

  /* 强调色：琥珀 → 明亮琥珀橙，与翠青撞色更精神 */
  --accent:       #E17509;
  --accent-dark:  #C96A10;
  --accent-ink:   #8A4A08;
  --accent-light: #FEF3E4;

  --ink:          #10222C;
  --ink-2:        #365160;
  --muted:        #5C7683;   /* 弱化正文压到 4.5:1 */
  --faint:        #7E97A3;   /* 占位/提示文字，3.1:1 保证浅底可读 */

  /* 背景去掉灰调，带一点点青，和品牌色呼应 */
  --bg:           #F0F6F7;
  --surface:      #FFFFFF;
  --surface-2:    #F7FBFC;
  --line:         #DCE7EA;
  --line-2:       #EBF2F4;

  /* 业务色：涨红跌绿（中国股市习惯），此处 up/down 用于经营涨跌而非股价 */
  --up:           #15846E;   /* 与 --brand 同值：白底红线/数字均达 4.6:1 */
  --down:         #D8362A;   /* 白底 5.0:1，仍保持鲜艳 */
  --warn:         #9A6B00;   /* 白底文字用深琥珀；图标背景另见 --warn-bright */
  --warn-bright:  #E0A008;   /* 图标/进度条等非文字场景 */
  --danger:       #D93A2C;   /* 错误文案，4.6:1 */

  /* 渐变与光晕：装饰性亮色集中在这里 */
  --grad-brand:   linear-gradient(135deg, #15846E 0%, #1A9E84 100%);
  --grad-side:    linear-gradient(180deg, #0E3A4A 0%, #0B2E3C 100%);
  --grad-accent:  linear-gradient(135deg, #F08A24 0%, #FFAE55 100%);
  --ring:         0 0 0 3px rgba(12,142,120,.18);

  --r-sm: 4px;
  --r:    8px;
  --r-lg: 12px;

  --sh-1: 0 1px 2px rgba(23,38,45,.05);
  --sh-2: 0 2px 8px rgba(23,38,45,.07);
  --sh-3: 0 8px 28px rgba(23,38,45,.14);

  --sidebar-w: 216px;
  --topbar-h: 56px;

  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
          system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

button, input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #C9D4D8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #AEBCC2; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 表单 ============================ */

.field { margin-bottom: 16px; }

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.field .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }

.input:hover, .select:hover, .textarea:hover { border-color: #CBD6DA; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.input:disabled, .select:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }

.input.err { border-color: var(--danger); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%236C8088' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.input.num, .input[type=number] { font-family: var(--mono); font-size: 13px; text-align: right; }
.input.sm, .select.sm { height: 30px; font-size: 12px; padding: 0 9px; }
.input.sm[type=date] { width: 136px; }

/* 勾选 */
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 13px; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* ============================ 按钮 ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn:hover { border-color: #C3D0D5; background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(12,142,120,.30);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #15846E 0%, #1A9E84 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(12,142,120,.38);
}
.btn.primary:active { box-shadow: 0 1px 4px rgba(12,142,120,.30); }

.btn.danger { background: var(--surface); border-color: #E8BDB5; color: var(--danger); }
.btn.danger:hover { background: #FDF3F1; border-color: var(--danger); }

.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }

.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn.lg { height: 42px; font-size: 14px; padding: 0 22px; }

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--brand); font-size: 13px; cursor: pointer; font-weight: 500;
}
.btn-link:hover { color: var(--brand-dark); text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: #B22619; }

/* ============================ 登录页 ============================ */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.auth-hero {
  background:
    radial-gradient(120% 90% at 88% 8%, rgba(18,196,164,.55) 0%, rgba(18,196,164,0) 58%),
    linear-gradient(152deg, #04362F 0%, #0A7A67 50%, #119E85 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  right: -140px; bottom: -180px;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
  filter: blur(2px);
}
.auth-hero::before {
  content: "";
  position: absolute;
  right: 40px; top: -110px;
  width: 250px; height: 250px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  filter: blur(2px);
}

.auth-brand { display: flex; align-items: center; gap: 11px; position: relative; }

.auth-logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: #fff;
  color: var(--brand);
  box-shadow: 0 6px 18px rgba(3,60,52,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
  letter-spacing: -.5px;
}

.auth-brand-txt { font-size: 17px; font-weight: 600; letter-spacing: 2px; }

.auth-hero h1 {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.42;
  margin-bottom: 18px;
  letter-spacing: .5px;
  position: relative;
}

.auth-hero .lead {
  font-size: 14px;
  line-height: 1.95;
  color: rgba(255,255,255,.82);
  max-width: 380px;
  position: relative;
}

.auth-points { position: relative; margin-top: 34px; display: grid; gap: 15px; }

.auth-point { display: flex; gap: 12px; align-items: flex-start; }

.auth-point .dot {
  flex: none;
  width: 22px; height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}

.auth-point .pt { font-size: 13.5px; font-weight: 500; }
.auth-point .ps { font-size: 12.5px; color: rgba(255,255,255,.66); }

.auth-foot { font-size: 12px; color: rgba(255,255,255,.5); position: relative; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}

.auth-card { width: 100%; max-width: 348px; }

.auth-card h2 { font-size: 21px; font-weight: 600; margin-bottom: 5px; }
.auth-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 26px; }

.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 20px; }

.auth-tip {
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--brand-soft);
  border: 1px solid #CFE6E1;
  border-radius: var(--r);
  font-size: 12px;
  color: var(--brand-dark);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { padding: 24px; }
}

/* ============================ 主框架 ============================ */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--grad-side);
  color: #C9DDE3;
  box-shadow: 1px 0 0 rgba(255,255,255,.04) inset, 4px 0 24px rgba(8,40,52,.18);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}

.side-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex: none;
}

.side-logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 3px 10px rgba(12,142,120,.42);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

.side-name { font-size: 14.5px; font-weight: 600; color: #fff; letter-spacing: 1.4px; }
.side-env { font-size: 10.5px; color: #7FA3AE; letter-spacing: .4px; }

.side-scroll { flex: 1; overflow-y: auto; padding: 10px 0 18px; }
.side-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); }

.nav-group { margin-bottom: 3px; }

.nav-group-title {
  font-size: 11px;
  color: #6C939F;
  letter-spacing: 1px;
  padding: 12px 16px 5px;
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  font-size: 13.5px;
  color: #BED5DC;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .13s, color .13s;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(12,142,120,.34) 0%, rgba(12,142,120,.08) 100%);
  color: #fff;
  border-left-color: #22D3B4;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,30,26,.28);
}

.nav-ico { width: 17px; text-align: center; flex: none; opacity: .92; font-size: 14px; }
.nav-item.active .nav-ico { opacity: 1; color: #35E0C2; }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  background: rgba(255,255,255,.16);
  padding: 0 6px;
  border-radius: 8px;
  line-height: 17px;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title { font-size: 15.5px; font-weight: 600; }
.topbar-sub { font-size: 12.5px; color: var(--muted); margin-left: 4px; }
.topbar-spacer { flex: 1; }

.store-pick {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
}
.store-pick:hover { border-color: var(--brand); }
.store-pick .lbl { color: var(--faint); font-size: 12px; }

.user-btn {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px 0 4px;
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
}
.user-btn:hover { background: var(--surface-2); border-color: var(--line); }

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex: none;
}

.page { padding: 20px; flex: 1; min-width: 0; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 17px; font-weight: 600; }
.page-head .sp { flex: 1; }

/* ============================ 卡片 ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.card + .card { margin-top: 16px; }

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sp { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.c23 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.grid.c32 { grid-template-columns: minmax(0,1fr) minmax(0,2fr); }

@media (max-width: 1180px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.c23, .grid.c32 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
}

/* KPI */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  box-shadow: var(--sh-1);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--grad-brand);
  opacity: .95;
}
.kpi.accent::after { background: var(--grad-accent); }
.kpi.warn::after   { background: var(--warn); }
.kpi.danger::after { background: var(--danger); }

.kpi .k-label { font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.kpi .k-value {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: -.4px;
  line-height: 1.2;
}
.kpi .k-value.sm { font-size: 19px; }
.kpi .k-foot { font-size: 12px; color: var(--faint); margin-top: 7px; display: flex; gap: 10px; flex-wrap: wrap; }
.kpi .k-foot b { font-weight: 500; color: var(--ink-2); font-family: var(--mono); }

/* ============================ 表格 ============================ */

.tbl-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

table.tbl thead th {
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 12.5px;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.tbl tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

table.tbl tbody tr:hover { background: var(--brand-soft); }
table.tbl tbody tr.voided { opacity: .48; }
table.tbl tbody tr.voided td { text-decoration: line-through; }

table.tbl tfoot td {
  padding: 10px 12px;
  background: var(--surface-2);
  font-weight: 500;
  border-top: 1px solid var(--line);
}

.tbl .r { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.tbl .c { text-align: center; }
.tbl .nowrap { white-space: nowrap; }
.tbl .strong { font-weight: 500; }

.money { font-family: var(--mono); }
.money.up   { color: var(--up); }
.money.down { color: var(--down); }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}
.empty .em-ico { font-size: 30px; opacity: .35; display: block; margin-bottom: 10px; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pager .sp { flex: 1; }
.pager .pg {
  min-width: 30px; height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
}
.pager .pg:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager .pg.on { background: var(--grad-brand); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(12,142,120,.28); }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }

/* ============================ 标签 ============================ */

.tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.tag.sale     { background: var(--brand-light); color: var(--brand-ink); border-color: #A9E8DA; }
.tag.purchase { background: #E8F1FE; color: #2A5EA8; border-color: #C6DAF8; }
.tag.return   { background: var(--accent-light); color: var(--accent-ink); border-color: #FADCB4; }
.tag.transfer { background: #F2EDFD; color: #6247A8; border-color: #DCD0F7; }
.tag.ok       { background: var(--brand-light); color: var(--brand-ink); border-color: #A9E8DA; }
.tag.void     { background: #F4F5F5; color: var(--muted); }
.tag.low      { background: #FDEBE8; color: #B52C1F; border-color: #F8CEC6; }
.tag.warn     { background: var(--accent-light); color: var(--accent-ink); border-color: #FADCB4; }

/* ============================ 弹窗 ============================ */

.mask {
  position: fixed;
  inset: 0;
  background: rgba(19,34,40,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: pop .16s ease;
}
@keyframes pop { from { opacity:0; transform: translateY(-8px) } to { opacity:1; transform:none } }

.modal.wide { max-width: 860px; }
.modal.narrow { max-width: 400px; }

.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
  flex: none;
}
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-head .sp { flex: 1; }
.modal-x {
  width: 26px; height: 26px;
  border: none; background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer; color: var(--muted);
  font-size: 17px; line-height: 1;
}
.modal-x:hover { background: var(--surface-2); color: var(--ink); }

.modal-body { padding: 18px; overflow-y: auto; flex: 1; }

.modal-foot {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-2);
  flex: none;
}
.modal-foot .sp { flex: 1; }

/* 轻提示 */
.toasts {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #123C48;
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--r);
  font-size: 13px;
  box-shadow: var(--sh-3);
  animation: drop .2s ease;
  max-width: 460px;
  white-space: pre-wrap;
}
.toast.ok   { background: linear-gradient(135deg, #15846E, #1A9E84); box-shadow: 0 6px 20px rgba(12,142,120,.34); }
.toast.err  { background: linear-gradient(135deg, #D8362A, #EE5A42); box-shadow: 0 6px 20px rgba(216,54,42,.30); }
@keyframes drop { from { opacity:0; transform: translateY(-12px) } to { opacity:1; transform:none } }

/* ============================ 杂项 ============================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .sp { flex: 1; }
.toolbar .input, .toolbar .select { height: 34px; }
.toolbar .w-sm { width: 130px; }
.toolbar .w-md { width: 190px; }
.toolbar .w-lg { width: 250px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  height: 32px; padding: 0 14px;
  border: none; background: var(--surface);
  font-size: 13px; cursor: pointer; color: var(--ink-2);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--surface-2); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 500; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.fs12 { font-size: 12px; }
.fs13 { font-size: 13px; }
.mono { font-family: var(--mono); }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }

.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; }

.notice {
  padding: 10px 13px;
  border-radius: var(--r);
  font-size: 12.5px;
  line-height: 1.75;
  margin-bottom: 14px;
}
.notice.info { background: var(--brand-soft); border: 1px solid #CFE6E1; color: var(--brand-dark); }
.notice.warn { background: var(--accent-light); border: 1px solid #EFD9B8; color: #7A4A0C; }
.notice.err  { background: #FDF3F1; border: 1px solid #F0CFC7; color: #8E3220; }

/* 载入 */
.loading { padding: 40px; text-align: center; color: var(--faint); font-size: 13px; }

.spin {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
.spin.dark { border-color: rgba(12,142,120,.25); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg) } }

/* ============================ 开单表格 ============================ */

.items-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-tbl thead th {
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.items-tbl tbody td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.items-tbl .input, .items-tbl .select { height: 32px; font-size: 13px; }
.items-tbl .col-no { width: 42px; text-align: center; color: var(--faint); }
.items-tbl .col-qty { width: 108px; }
.items-tbl .col-price { width: 118px; }
.items-tbl .col-amt { width: 120px; }
.items-tbl .col-del { width: 54px; text-align: center; }
.items-tbl .ro { padding: 0 4px; font-family: var(--mono); font-size: 13px; }

.prod-pick {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  overflow: hidden;
}
.prod-pick:hover { border-color: var(--brand); }
.prod-pick .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-pick.empty .nm { color: var(--faint); }
.prod-pick .stk { font-size: 11.5px; color: var(--muted); font-family: var(--mono); flex: none; }

.sum-row { display: flex; justify-content: flex-end; gap: 34px; padding: 5px 0; font-size: 13px; }
.sum-row .lb { color: var(--muted); }
.sum-row .vl { font-family: var(--mono); min-width: 110px; text-align: right; font-weight: 500; }
.sum-row.total .vl { font-size: 17px; color: var(--brand); }

/* 图表 */
.chart-box { width: 100%; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 11px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.chart-tip {
  position: fixed;
  background: #123C48;
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  pointer-events: none;
  z-index: 400;
  white-space: nowrap;
  font-family: var(--mono);
}

/* 商品选择弹窗列表 */
.pick-list { max-height: 380px; overflow-y: auto; }
.pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.pick-row:hover { background: var(--brand-soft); }
.pick-row .nm { flex: 1; min-width: 0; }
.pick-row .nm b { font-weight: 500; display: block; }
.pick-row .nm span { font-size: 12px; color: var(--muted); }
.pick-row .qty { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

/* 抽屉（单据详情） */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(19,34,40,.34);
  z-index: 150;
  animation: fade .14s ease;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 620px;
  max-width: 96vw;
  background: var(--surface);
  box-shadow: var(--sh-3);
  z-index: 151;
  display: flex;
  flex-direction: column;
  animation: slide .18s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6 } to { transform: none; opacity: 1 } }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-2); flex: none;
}
.drawer-head h3 { font-size: 15px; font-weight: 600; }
.drawer-head .sp { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot {
  display: flex; gap: 9px; padding: 13px 18px;
  border-top: 1px solid var(--line-2); flex: none;
}
.drawer-foot .sp { flex: 1; }

@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .page { padding: 14px; }
}

/* ============================================================
   启动等待屏（index.html 首帧）
   ============================================================ */

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
}
.boot-logo {
  width: 58px; height: 58px;
  border-radius: 15px;
  background: var(--grad-brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(12,142,120,.30);
}
.boot-name {
  font-size: 19px; font-weight: 600; letter-spacing: 5px;
  color: var(--ink); text-indent: 5px;
}
.boot-sub { font-size: 12px; color: var(--muted); letter-spacing: 1.2px; }
.boot-bar {
  width: 132px; height: 3px; margin-top: 8px;
  background: var(--line); border-radius: 2px; overflow: hidden;
}
.boot-bar i {
  display: block; width: 42%; height: 100%;
  background: var(--brand); border-radius: 2px;
  animation: bootmove 1.1s ease-in-out infinite;
}
@keyframes bootmove {
  0%   { transform: translateX(-105%); }
  100% { transform: translateX(240%); }
}

/* ============================================================
   表格行态与数字着色
   ============================================================ */

.tbl tbody tr.warn-row { background: #FEF8EE; }
.tbl tbody tr.warn-row:hover { background: #FDF2E0; }
.tbl tbody tr.voided { opacity: .62; }
.tbl tbody tr.voided:hover { opacity: 1; }

.money.up, .mono.up  { color: var(--up); }
.money.down, .mono.down { color: var(--down); }

/* 表格内嵌提示行 */
.tbl td .faint.fs12 { display: block; margin-top: 2px; }

@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c23, .grid.c32 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .toolbar .w-lg, .toolbar .w-md { width: 100%; }
}

/* ============================================================
   总后台（平台管理端）— 与租户端视觉区分：深墨侧栏
   ============================================================ */

.sidebar.console {
  background: linear-gradient(180deg, #1B2A4A 0%, #131F38 100%);
  border-right-color: #0E1830;
}
.sidebar.console .side-brand { border-bottom-color: rgba(255,255,255,.08); }
.side-logo.console { background: var(--grad-accent); box-shadow: 0 3px 10px rgba(240,138,36,.42); }
.sidebar.console .side-name { color: #EAF2F1; }
.sidebar.console .side-env { color: rgba(255,255,255,.42); }
.sidebar.console .nav-group-title { color: rgba(255,255,255,.32); }
.sidebar.console .nav-item { color: rgba(255,255,255,.68); }
.sidebar.console .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar.console .nav-item.active {
  background: linear-gradient(90deg, rgba(240,138,36,.30) 0%, rgba(240,138,36,.06) 100%);
  color: #FFD8A8;
  box-shadow: inset 3px 0 0 #FFAE55;
}
.avatar.console { background: var(--grad-accent); }

.side-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.side-link {
  display: block; font-size: 12px; color: rgba(255,255,255,.5);
  text-decoration: none; transition: color .15s;
}
.side-link:hover { color: #FFD8A8; }

.auth-hero.console {
  background:
    radial-gradient(120% 90% at 88% 8%, rgba(255,174,85,.30) 0%, rgba(255,174,85,0) 58%),
    linear-gradient(155deg, #131F38 0%, #1B2A4A 54%, #24406B 100%);
}
.auth-logo { }
.auth-hero.console .auth-logo { background: var(--grad-accent); }

/* 授权状态标签 */
.tag.lic-perm { background: var(--brand-light); color: var(--brand-ink); border-color: #A9E8DA; }
.tag.lic-ok   { background: #E6F7EF; color: #17795A; border-color: #BFE9D6; }
.tag.lic-wait { background: #F0F4F6; color: var(--muted); border-color: #DBE5E9; }
.tag.lic-exp  { background: #FDEBE8; color: #B52C1F; border-color: #F8CEC6; }
.lic-left {
  display: inline-block; margin-left: 5px; font-size: 11px;
  color: var(--warn); font-family: var(--mono);
}

/* 客户列表双行单元格 */
.cell-2 { display: flex; flex-direction: column; line-height: 1.45; }
.cell-2 b { font-weight: 600; }

/* ============================================================
   通用补充：卡片网格 / 区块标题 / 筛选条 / 指标卡
   ============================================================ */

.kpis {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 14px; box-shadow: var(--sh-1);
}
.kpi-l { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.kpi-v { font-size: 21px; font-weight: 600; color: var(--ink); letter-spacing: -.4px; }
.kpi-s { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.kpi.ok   .kpi-v { color: var(--brand); }
.kpi.perm .kpi-v { color: var(--accent); }
.kpi.exp  .kpi-v { color: var(--danger); }
.kpi.warn .kpi-v { color: var(--warn); }

.grid-2 {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-grid {
  display: grid; gap: 0 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sec {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  margin: 0 0 10px; letter-spacing: .2px;
}
.sec:first-child { margin-top: 0; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.req { color: var(--danger); font-weight: 400; }

/* ============================================================
   授权方式选择（开通 / 调整授权）
   ============================================================ */

.lic-choice { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lic-opt {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 12px 13px; cursor: pointer; background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.lic-opt:hover { border-color: #C3D6D2; background: var(--surface-2); }
.lic-opt.on {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(12,142,120,.07);
}
.lic-opt input { margin-top: 2px; accent-color: var(--brand); flex: none; }
.lic-opt > div { display: flex; flex-direction: column; gap: 3px; }
.lic-opt b { font-size: 13px; color: var(--ink); font-weight: 600; }
.lic-opt span { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.quick-lic { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: var(--r-sm); }

/* ============================================================
   商品：条码 / 批量导入导出
   ============================================================ */

.barcode-cell { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.barcode-cell.empty { color: var(--faint); font-family: inherit; }

.scan-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--brand-soft); border: 1px solid #CFE6E1;
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 12px;
}
.scan-bar .scan-ico { color: var(--brand); flex: none; }
.scan-bar input { flex: 1; min-width: 0; }
.scan-hit {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #CFE6E1; background: #fff;
  border-radius: var(--r); padding: 9px 11px; margin-top: 8px;
}
.scan-hit .nm { font-weight: 600; font-size: 13px; }
.scan-hit .meta { font-size: 11.5px; color: var(--muted); }

/* 导入结果 */
.imp-sum {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 11px 13px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px;
}
.imp-sum .it { display: flex; flex-direction: column; gap: 2px; }
.imp-sum .it .lb { font-size: 11.5px; color: var(--muted); }
.imp-sum .it .vl { font-size: 17px; font-weight: 600; font-family: var(--mono); }
.imp-sum .it.ok .vl { color: var(--brand); }
.imp-sum .it.bad .vl { color: var(--danger); }

.imp-help { font-size: 12px; color: var(--muted); line-height: 1.85; }
.imp-help code {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 5px;
}
.imp-drop {
  border: 1.5px dashed var(--line); border-radius: var(--r);
  padding: 16px; text-align: center; color: var(--muted); font-size: 12.5px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.imp-drop:hover, .imp-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.imp-preview {
  max-height: 210px; overflow: auto; margin-top: 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
}

/* ============================================================
   开单：结算方式选择
   ============================================================ */

.settle-choice { display: grid; gap: 9px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settle-opt {
  border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 10px 11px; cursor: pointer; background: var(--surface);
  text-align: center; transition: border-color .15s, background .15s, box-shadow .15s;
}
.settle-opt:hover { border-color: #C3D6D2; background: var(--surface-2); }
.settle-opt.on {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(12,142,120,.07);
}
.settle-opt b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.settle-opt span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.settle-opt.deposit.on { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 3px rgba(201,122,22,.08); }

/* 单据结算进度条（列表 / 详情） */
.settle-bar {
  display: inline-flex; height: 6px; width: 74px; border-radius: 3px;
  overflow: hidden; background: #EDF1F2; vertical-align: middle;
}
.settle-bar i { display: block; height: 100%; }
.settle-bar i.paid { background: var(--brand); }
.settle-bar i.dep  { background: var(--accent); }

/* 单据详情结算摘要 */
.settle-sum {
  display: grid; gap: 0; border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.settle-sum .row {
  display: flex; align-items: center; padding: 9px 13px;
  border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.settle-sum .row:last-child { border-bottom: none; }
.settle-sum .row .k { color: var(--muted); }
.settle-sum .row .sp { flex: 1; }
.settle-sum .row .v { font-family: var(--mono); font-weight: 600; }
.settle-sum .row.total { background: var(--surface-2); }
.settle-sum .row.total .v { font-size: 15px; color: var(--ink); }

/* ============================================================
   应收管理：三类金额
   ============================================================ */

.recv-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.recv-card {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; background: var(--surface); box-shadow: var(--sh-1);
}
.recv-card .l { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.recv-card .v { font-size: 22px; font-weight: 600; font-family: var(--mono); margin-top: 6px; letter-spacing: -.5px; }
.recv-card .s { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.recv-card.total { background: linear-gradient(150deg, #F1F8F6, #FFFFFF); border-color: #CFE6E1; }
.recv-card.total .v { color: var(--brand); }
.recv-card.dep { background: linear-gradient(150deg, #FBF1E2, #FFFFFF); border-color: #EBD6B4; }
.recv-card.dep .v { color: var(--accent); }
.recv-card.unp { background: linear-gradient(150deg, #FCEDEA, #FFFFFF); border-color: #F3D2CB; }
.recv-card.unp .v { color: var(--danger); }
.recv-card.paid .v { color: var(--ink-2); }

.recv-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.recv-dot.total { background: var(--brand); }
.recv-dot.dep { background: var(--accent); }
.recv-dot.unp { background: var(--danger); }
.recv-dot.paid { background: var(--ink-2); }

/* 结算方式标签 */
.tag.settle { font-size: 11.5px; }
.tag.settle.full { background: #EAF4F1; color: #1D6B5C; border-color: #CFE6E1; }
.tag.settle.deposit { background: var(--accent-light); color: #8A5410; border-color: #EBD6B4; }
.tag.settle.unpaid { background: #FCEDEA; color: #A63A28; border-color: #F3D2CB; }

/* 结算摘要条（详情 / 拆分页内联） */
.settle-sum .s-total2, .settle-sum .s-deposit, .settle-sum .s-unpaid,
.settle-sum .s-paid, .settle-sum .s-due {
  margin-right: 18px; color: var(--muted); font-size: 12.5px; white-space: nowrap;
}
.settle-sum .s-total2 b, .settle-sum .s-deposit b, .settle-sum .s-unpaid b,
.settle-sum .s-paid b, .settle-sum .s-due b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.settle-sum .s-deposit b { color: var(--accent); }
.settle-sum .s-unpaid b { color: var(--danger); }
.settle-sum .s-due b { color: var(--brand); }
.settle-sum .s-total2 { color: var(--ink-2); }

/* 列表结算列的定金 / 欠款微标 */
.fs12 .sd { color: var(--accent); }
.fs12 .su { color: var(--danger); }

/* 应收拆分明细里的分组小标题 */
.recv-sub { font-size: 12.5px; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.recv-sub .sp { flex: 1; }

/* 授权期限提示条（租户端顶部） */
.lic-banner {
  display: flex; align-items: center; gap: 9px;
  background: var(--accent-light); border: 1px solid #EBD6B4;
  color: #8A5410; border-radius: var(--r);
  padding: 9px 13px; margin-bottom: 12px; font-size: 12.5px;
}
.lic-banner b { font-family: var(--mono); }

@media (max-width: 1100px) {
  .recv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settle-choice { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .recv-grid, .settle-choice, .lic-choice { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ============================================================
   移动端 / 安卓 App 适配
   ------------------------------------------------------------
   窄屏（<=900px）时侧栏改为抽屉式，顶栏出现汉堡按钮；
   表格、卡片、弹窗按一列排布，触控目标放大到 40px 以上。
   ============================================================ */

/* 服务地址条（登录页） */
.server-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 7px 10px; margin-bottom: 14px;
  font-size: 12px; color: var(--muted);
}
.server-bar .srv-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); flex: none;
}
.server-bar .srv-txt { flex: none; }
.server-bar .srv-url {
  flex: 1; min-width: 0; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.server-bar .btn { flex: none; }

/* 汉堡按钮：宽屏不显示 */
.nav-toggle {
  display: none;
  width: 34px; height: 34px; flex: none;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); color: var(--ink-2);
  cursor: pointer; padding: 0;
}
.nav-toggle:active { background: var(--brand-soft); }

/* 抽屉遮罩 */
.scrim {
  display: none; position: fixed; inset: 0;
  background: rgba(9, 26, 30, .45); z-index: 29;
}
.scrim.show { display: block; }

/* 扫码按钮 */
.scan-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; }
.scan-btn:active { background: var(--brand-soft); border-color: var(--brand); }

@media (max-width: 900px) {
  :root { --sidebar-w: 232px; }

  .nav-toggle { display: inline-flex; }

  /* 侧栏变抽屉 */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 34px rgba(0,0,0,.28);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }

  /* 顶栏收窄，标题允许省略 */
  .topbar { gap: 9px; padding: 0 12px; }
  .topbar-sub { display: none; }
  .topbar > div:first-of-type { min-width: 0; overflow: hidden; }
  .topbar-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-btn span:not(.avatar) { display: none; }
  .store-pick .lbl { display: none; }

  /* 内容区与卡片 */
  .page { padding: 13px; }
  .card + .card { margin-top: 12px; }

  /* 宽表格横向滚动，避免挤压变形 */
  .tbl-wrap, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tbl { min-width: 620px; }

  /* 表单与弹窗 */
  .modal { width: calc(100vw - 24px) !important; max-width: 560px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0,1fr); }

  /* 触控目标放大 */
  .btn { min-height: 36px; }
  .btn.sm { min-height: 32px; padding: 0 10px; }
  .input, .select { min-height: 38px; font-size: 15px; }

  /* 开单页的结算方式等：一列 */
  .settle-choice { grid-template-columns: minmax(0,1fr); }
  .recv-grid { grid-template-columns: minmax(0,1fr); }
}

/* 手机号/条码等输入避免 iOS 自动放大 */
@media (max-width: 900px) {
  input, select, textarea { font-size: 15px; }
}

/* 安全区（刘海屏 / 手势条） */
@supports (padding: env(safe-area-inset-bottom)) {
  .page { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}
