/* ============================================================
   四端共享设计系统（单套，REQ-013）
   - v1 基础层与 v2 增强层已合并为唯一实现，删除全部叠写覆盖链
   - 品牌色只覆盖 --brand 一个入口，明暗/浅底/渐变/焦点环/阴影
     全部由 color-mix 自动派生（旧浏览器回退为静态青色系）
   - 适老规格：body.elder 基准 20px、麦克风放大、控件增高
   - 动效统一尊重 prefers-reduced-motion；悬浮上浮仅限可点卡片
   ============================================================ */

:root {
  --brand: #0F766E;            /* 主色（唯一入口，页面按 /api/me 的 brand 覆盖） */
  /* 派生令牌静态回退值：不支持 color-mix 的浏览器（Chrome <111 / Edge <111 / 旧 WebView）直接使用；
     注意：同一令牌不能用「先静态、后 color-mix」两条声明覆盖——后一条在使用处整条失效时不会回退到前一条，
     因此派生值改写进下方 @supports 块（旧浏览器只保留这里的静态值） */
  --brand-dark: #0B5750;
  --brand-2: #14B8A6;
  --brand-light: #E6F2F0;
  /* 承载白字的渐变必须两端都满足 AA：浅色端改用深色端，--brand-2 只做装饰（DES-009 §3.2） */
  --brand-grad: linear-gradient(135deg, #0F766E 0%, #0B5750 100%);
  --focus-ring: rgba(15, 118, 110, 0.4);
  --brand-shadow: rgba(15, 118, 110, 0.26);
  --brand-shadow-lg: rgba(15, 118, 110, 0.34);

  --accent: #F59E0B;           /* 暖橙：待办 / 强调 */
  --accent-light: #FEF3C7;
  --n0: #F8FAFC;               /* 中性五阶：最浅底 */
  --n1: #F1F5F9;
  --n2: #E2E8F0;
  --n3: #5B6B7F;                /* 次要文字：白底/浅灰底均满足 AA（DES-009 §3.2） */
  --n4: #0F172A;               /* 中性五阶：最深字 */
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #5B6B7F;
  --line: #E2E8F0;
  --ok: #16A34A;
  --ok-text: #15803D;           /* 白底绿色文字专用：#16A34A 作文字仅 3.3:1，此值约 5:1 满足 AA */
  --warn: #B45309;             /* 白字底色需 ≥4.5:1（原 #D97706 仅 3.9:1） */
  --danger: #DC2626;
  --info: #2563EB;
  --radius: 14px;
  --radius-ctl: 10px;
  /* 控件热区下限（DES-009 §3.2）：默认 44px，字号档位只抬高不降低 */
  --ctl-h: 44px;
  --ctl-h-sm: 44px;
  --ctl-h-lg: 56px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.14);
  --shadow: var(--shadow-sm);
}

/* 派生品牌令牌仅在支持 color-mix 的浏览器生效；旧浏览器沿用 :root 的静态青色系，
   保证顶栏渐变、主色按钮底色、焦点环与阴影不会因变量失效而整条丢失 */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --brand-dark: color-mix(in oklch, var(--brand) 72%, black);
    --brand-2: color-mix(in oklch, var(--brand) 72%, white);
    --brand-light: color-mix(in srgb, var(--brand) 10%, white);
    --brand-grad: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    --focus-ring: color-mix(in srgb, var(--brand) 40%, transparent);
    --brand-shadow: color-mix(in srgb, var(--brand) 26%, transparent);
    --brand-shadow-lg: color-mix(in srgb, var(--brand) 34%, transparent);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 适老化：用户端基础字号 20px 以上 */
body.elder { font-size: 20px; }

/* 字号档位（DES-009 §3.2）：default / large / xlarge，仅改基准字号与控件高度，不改布局结构 */
html[data-ui-scale="large"] { --ctl-h: 52px; --ctl-h-sm: 48px; --ctl-h-lg: 60px; }
html[data-ui-scale="xlarge"] { --ctl-h: 56px; --ctl-h-sm: 52px; --ctl-h-lg: 64px; }
html[data-ui-scale="large"] body.elder { font-size: 24px; }
html[data-ui-scale="xlarge"] body.elder { font-size: 28px; }
html[data-ui-scale="large"] body:not(.elder) { font-size: 17px; }
html[data-ui-scale="xlarge"] body:not(.elder) { font-size: 18px; }

/* ---------- 布局 ---------- */
/* 微信等浏览器会按用户字号设置放大页面文本导致错位（REQ-181）：锁定缩放 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.page { max-width: 680px; margin: 0 auto; padding: 16px 16px 100px; padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
.page-wide { max-width: 1180px; margin: 0 auto; padding: 20px 24px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 14px;
  background: var(--brand-grad); color: #fff;
  box-shadow: var(--shadow-sm);
}
/* 顶栏在特大字号 + 375px 下不得横向溢出：品牌名占满剩余空间并按需省略，右侧徽标不换行 */
.topbar .brand { flex: 1 1 0; min-width: 0; font-size: 1.15em; font-weight: 700; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub {
  margin-left: 0; font-size: 0.85em; text-align: right; flex: 0 1 auto; min-width: 0;
  max-width: 42vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 999px;
  padding: 5px 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.topbar .sub .money { font-weight: 700; }
body.elder .topbar .sub { font-size: 0.8em; }
/* 窄屏（≤420px，主流小屏安卓与微信内嵌）顶栏两行化（REQ-181）：
   品牌独占一行不再被挤压，第二行放余额徽标与 SOS；余额徽标仅保留金额（姓名移入「我的」页） */
@media (max-width: 420px) {
  .topbar { flex-wrap: wrap; padding: 12px 10px 10px; gap: 6px 8px; }
  .topbar .brand { flex: 1 1 100%; }
  .topbar .sub:not(#extrasBell) { flex: 1 1 100%; max-width: none; padding: 5px 10px; }
  #extrasBell { flex: 0 0 auto; }
  .topbar .sub .sub-name { display: none; }
  .sos-btn { padding: 0 10px; font-size: 13px; letter-spacing: 0; white-space: nowrap; }
}

/* 底部 Tab 栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: #fff; border-top: 1px solid var(--line);
  /* iPhone 异形屏安全区：需配合页面 meta viewport-fit=cover；老内核回退 4px */
  padding-bottom: 4px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}
.tabbar button {
  position: relative;
  flex: 1; min-height: 64px; padding: 6px 4px;
  border: none; background: none; cursor: pointer;
  font-size: 16px; color: var(--muted); font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: color 0.15s ease;
}
.tabbar button.active { color: var(--brand); font-weight: 700; }
.tabbar button.active::after {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
}
body.elder .tabbar button { font-size: 18px; }

/* 运营端：左侧导航布局（窄屏折叠为顶部横排，见文末媒体查询） */
.admin-layout { display: flex; min-height: 100vh; }
.admin-nav {
  width: 200px; flex-shrink: 0;
  background: #0F172A; color: #CBD5E1;
  display: flex; flex-direction: column; padding: 14px 10px; gap: 4px;
}
.admin-nav .nav-title { color: #fff; font-weight: 700; padding: 8px 12px 16px; font-size: 17px; }
.admin-nav button {
  min-height: 46px; padding: 0 14px; text-align: left;
  border: none; border-radius: 8px; background: none; color: #CBD5E1;
  font-size: 15px; cursor: pointer; font-family: inherit;
}
.admin-nav button.active { background: var(--brand); color: #fff; font-weight: 700; }
.admin-main { flex: 1; min-width: 0; padding: 20px 24px; max-width: 1440px; margin: 0 auto; width: 100%; }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--n2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; font-size: 1.06em; font-weight: 700;
}
.card-title::before {
  content: ''; width: 4px; height: 15px; border-radius: 2px;
  background: var(--brand); flex-shrink: 0;
}

/* 可点卡片：div 与 button 两种实现统一规格；悬浮上浮仅限可点卡片且仅限悬停设备 */
.card.clickable { cursor: pointer; border-width: 1.5px; }
.card.clickable.selected { border-color: var(--brand); background: var(--brand-light); }
button.card {
  width: 100%; text-align: left; font-family: inherit; font-size: inherit;
  color: inherit; line-height: inherit;
}
@media (hover: hover) {
  .card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
}
summary { cursor: pointer; }
summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- 按钮 ----------
   基类为中性次级样式（白底描边）；primary/ghost/danger/warn 变体覆盖。
   基准 44px，适老 48px+；全部带焦点环。 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ctl-h); padding: 0 18px;
  border: 1.5px solid var(--n2); border-radius: var(--radius-ctl);
  background: #fff; color: var(--n4);
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.btn:not(:disabled):active { transform: scale(0.98); }
/* 中性默认态的 hover：描边加深 + 浅底；变体不受影响 */
.btn:not(:disabled):not(.btn-primary):not(.btn-ghost):not(.btn-danger):not(.btn-warn):hover {
  border-color: var(--n3); background: var(--n0);
}

.btn-primary {
  background: var(--brand-grad); color: #fff; border: none;
  box-shadow: 0 4px 12px var(--brand-shadow);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 6px 16px var(--brand-shadow-lg); }
.btn-ghost { background: #fff; color: var(--brand); border: 2px solid var(--brand); }
.btn-ghost:not(:disabled):hover { background: var(--brand-light); }
.btn-danger { background: var(--danger); color: #fff; border: none; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.22); }
.btn-warn { background: var(--warn); color: #fff; border: none; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: var(--ctl-h-sm); padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-lg { min-height: var(--ctl-h-lg); font-size: 20px; border-radius: 14px; }
.btn-primary.btn-lg { box-shadow: 0 6px 18px var(--brand-shadow-lg); }

body.elder .btn { min-height: calc(var(--ctl-h) + 6px); font-size: 18px; }
body.elder .btn-lg { font-size: 22px; }
body.elder .btn-sm { min-height: var(--ctl-h-sm); font-size: 15px; }
html[data-ui-scale="large"] body.elder .btn { font-size: 20px; }
html[data-ui-scale="xlarge"] body.elder .btn { font-size: 23px; }
html[data-ui-scale="large"] body.elder .btn-sm { font-size: 16px; }
html[data-ui-scale="xlarge"] body.elder .btn-sm { font-size: 17px; }

/* 语音麦克风大圆按钮：呼吸动画，录音中转红加速 */
.mic-btn {
  width: 88px; height: 88px; border-radius: 50%; border: 4px solid #fff;
  background: var(--brand-grad); color: #fff; font-size: 15px; line-height: 1.35;
  box-shadow: 0 8px 24px var(--brand-shadow-lg), 0 1px 3px rgba(15, 23, 42, 0.08);
  cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  animation: pulse 2.4s ease-in-out infinite;
}
.mic-btn.listening {
  background: linear-gradient(135deg, #B91C1C 0%, #DC2626 100%);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35), 0 1px 3px rgba(15, 23, 42, 0.08);
  animation-duration: 1s;
}
/* 语音能力不可用（REQ-016 批次3 C2）：按钮置灰停动画，替代路径见按钮下方提示 */
.mic-btn:disabled {
  background: #CBD5E1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  cursor: not-allowed;
  animation: none;
  opacity: 0.7;
}
body.elder .mic-btn { width: 104px; height: 104px; font-size: 17px; }
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* 开关（上下线、深夜需确认等）：role=switch 语义由创建方补齐 */
.switch {
  position: relative; width: 72px; height: 44px; flex-shrink: 0;
  border: none; border-radius: 999px; background: #CBD5E1; cursor: pointer;
  transition: background 0.2s; font-family: inherit;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 36px; height: 36px; border-radius: 50%; background: #fff;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch.on { background: var(--ok); }
.switch.on::after { left: 33px; }
.switch.on { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
.switch:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- 表单 ----------
   .field 内控件与独立 .input 类（extras 注入表单用）统一规格。 */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 6px; color: var(--n3); font-size: 0.9em; font-weight: 500; }
.field input[type="text"], .field input[type="number"], .field input[type="password"],
.field input[type="tel"], .field select, .field textarea,
.input {
  width: 100%; min-height: var(--ctl-h); padding: 8px 12px;
  font-size: 17px; font-family: inherit; color: var(--text);
  border: 1.5px solid var(--n2); border-radius: var(--radius-ctl); background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea, textarea.input { min-height: 130px; resize: vertical; }
select.input[multiple] { min-height: 80px; }
body.elder .field input, body.elder .field select, body.elder .input { min-height: calc(var(--ctl-h) + 4px); font-size: 18px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.radio-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; min-height: var(--ctl-h); }
.radio-row label { display: flex; align-items: center; gap: 6px; min-height: var(--ctl-h); cursor: pointer; }
.radio-row input[type="radio"], .radio-row input[type="checkbox"] { width: 20px; height: 20px; }
body.elder .radio-row input[type="radio"], body.elder .radio-row input[type="checkbox"] { width: 24px; height: 24px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-sm); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: var(--n1); color: var(--n3); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--n0); }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; top: 0; padding-top: 14px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  max-width: 92vw; pointer-events: none;
}
.toast {
  background: #fff; color: var(--n4);
  padding: 12px 18px 12px 15px;
  border: 1px solid var(--n2);
  border-left: 5px solid var(--brand);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 15px; font-weight: 500; max-width: 100%;
  animation: toast-in 0.3s ease-out;
  transition: opacity 0.3s;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.hide { opacity: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 模态 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 480px; max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s ease-out;
}
.modal h3 { margin: 0 0 12px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- 状态点与标签 ---------- */
.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}
.dot.s-created { background: #94A3B8; }
.dot.s-dispatching { background: #2563EB; }
.dot.s-accepted { background: #0891B2; }
.dot.s-en_route { background: #7C3AED; }
.dot.s-arrived { background: #D97706; }
.dot.s-in_service { background: #EA580C; }
.dot.s-finished { background: #65A30D; }
.dot.s-settled { background: #16A34A; }
.dot.s-cancelled { background: #9CA3AF; }
.dot.s-no_supply { background: #DC2626; }
.dot.s-disputed { background: #DC2626; }
.dot.s-other { background: #94A3B8; }

.tag {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: var(--brand-light); color: var(--brand-dark);
}
.tag.warn { background: #FEF3C7; color: #92400E; }
.tag.danger { background: #FEE2E2; color: #991B1B; }
.tag.ok { background: #DCFCE7; color: #166534; }
.tag.gray { background: #F3F4F6; color: #4B5563; }
.tag.accent { background: var(--accent-light); color: #92400E; display: inline-flex; align-items: center; min-height: var(--ctl-h-sm); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background:
    radial-gradient(circle at 18% 12%, rgba(20, 184, 166, 0.10), transparent 42%),
    radial-gradient(circle at 84% 88%, rgba(245, 158, 11, 0.10), transparent 42%),
    var(--n0);
}
.login-card { width: 100%; max-width: 420px; padding: 26px 22px; }
.login-brand { font-size: 30px; font-weight: 800; color: var(--brand); text-align: center; letter-spacing: 2px; }
.login-sub { text-align: center; color: var(--muted); margin: 4px 0 18px; }
.login-error { color: var(--danger); font-size: 15px; min-height: 22px; margin: 8px 0; text-align: center; }

/* ---------- 对话页 ---------- */
.prompt-big {
  font-size: 20px; font-weight: 700; line-height: 1.65;
  background: var(--brand-light);
  border: 2px solid var(--brand);
  border-radius: 18px 18px 18px 6px;
  padding: 14px 16px;
}
body.elder .prompt-big { font-size: 22px; }
.quote-big { font-size: clamp(32px, 12vw, 44px); font-weight: 800; color: var(--brand); text-align: center; margin: 10px 0; white-space: nowrap; }
body.elder .quote-big { font-size: clamp(34px, 12vw, 48px); }

.waiting { text-align: center; padding: 20px 0; }
.waiting .dots::after { content: ''; animation: dots 1.5s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ---------- 通用工具类 ---------- */
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 24px; }
.divider { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

/* ============================================================
   REQ-014 组件段：驾驶舱数字卡 / 条形图 / 订单时间轴 / 话术与理由
   chips / 统一空态 / 入场动效 / 顶栏 SOS / 首字头像
   ============================================================ */

/* 驾驶舱数字卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card {
  background: #fff; border: 1px solid var(--n2); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px 18px;
}
.stat-card .stat-label { color: var(--n3); font-size: 14px; font-weight: 500; }
.stat-card .stat-num {
  font-size: 30px; font-weight: 800; color: var(--n4);
  font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px;
}
.stat-card.hero {
  background: var(--brand-grad); border: none; color: #fff;
  box-shadow: 0 6px 18px var(--brand-shadow-lg);
}
.stat-card.hero .stat-label { color: #fff; }
.stat-card.hero .stat-num { color: #fff; }
.stat-card .stat-sub { color: var(--n3); font-size: 12.5px; margin-top: 4px; }
.stat-card.hero .stat-sub { color: rgba(255, 255, 255, 0.94); }

/* 迷你条形图（div/CSS 实现） */
.barchart { display: flex; align-items: flex-end; gap: 3px; height: calc(var(--bh, 120px) + 22px); padding: 4px 2px 0; }
.barchart .bcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.barchart .bar {
  width: 100%; max-width: 26px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  min-height: 0; transition: height 0.5s ease;
}
.barchart .blabel {
  font-size: 10.5px; color: var(--n3); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.barchart.dense .blabel { visibility: hidden; }
.barchart.dense .bcol:nth-child(5n+1) .blabel { visibility: visible; }

/* 订单时间轴（垂直步骤） */
.timeline { display: flex; flex-direction: column; margin: 12px 0 2px; }
.tl-step { display: flex; gap: 10px; position: relative; padding-bottom: 14px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { /* 连线 */
  content: ''; position: absolute; left: 8px; top: 20px; bottom: 0;
  width: 2px; background: var(--n2);
}
.tl-step:last-child::before { display: none; }
.tl-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  border: 2px solid var(--n2); background: #fff; position: relative; z-index: 1;
}
.tl-step.done .tl-dot { border-color: var(--ok); background: var(--ok); }
.tl-step.done .tl-dot::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.tl-step.current .tl-dot { border-color: var(--brand); background: var(--brand-light); animation: tl-breathe 1.6s ease-in-out infinite; }
@keyframes tl-breathe { 0%, 100% { box-shadow: 0 0 0 0 var(--focus-ring); } 50% { box-shadow: 0 0 0 6px transparent; } }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 600; font-size: 0.95em; }
.tl-step.todo .tl-title { color: var(--n3); font-weight: 400; }
.tl-time { color: var(--n3); font-size: 12.5px; }

/* 可点话术 / 快捷理由 chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--brand); color: var(--brand-dark); background: #fff;
  border-radius: 999px; padding: 10px 16px; min-height: var(--ctl-h-sm); font-size: 16px; font-family: inherit;
  cursor: pointer; transition: background 0.15s ease, transform 0.12s ease;
}
.chip:hover { background: var(--brand-light); }
.chip:active { transform: scale(0.97); }
.chip:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
body.elder .chip { font-size: 18px; min-height: var(--ctl-h); }
html[data-ui-scale="large"] body.elder .chip { font-size: 20px; }
html[data-ui-scale="xlarge"] body.elder .chip { font-size: 23px; }

/* 统一空态 */
.empty-state { text-align: center; padding: 26px 12px; }
.empty-ill { width: 92px; height: 70px; margin: 0 auto 10px; color: var(--n2); }
.empty-text { color: var(--muted); }

/* 卡片入场动效（stagger 依 --i 递进；reduced-motion 全局豁免已在文末） */
.fade-up { animation: fade-up 0.4s ease-out both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 顶栏常驻 SOS（老人端） */
.sos-btn {
  border: none; border-radius: 999px; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, #B91C1C, #DC2626); color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: 1px; white-space: nowrap;
  min-height: var(--ctl-h-sm); padding: 0 14px;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.4);
  display: inline-flex; align-items: center; gap: 6px;
}
.sos-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* 首字头像（老人卡 / 护工卡） */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
}

/* ---------- 语音引导与异常卡（DES-009 §3.3、§3.4） ---------- */
.voice-tip {
  background: var(--brand-light); border: 1.5px solid var(--brand);
  border-radius: 14px; padding: 14px 16px; margin: 12px 0;
}
.voice-tip .tip-text { font-weight: 600; line-height: 1.55; }
.voice-tip .tip-act { margin-top: 10px; }
.voice-progress { margin: 12px 0 0; }
.voice-progress .bar { height: 10px; background: var(--n2); border-radius: 999px; overflow: hidden; }
.voice-progress .bar > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width 1s linear; }
body.elder .voice-progress .bar { height: 14px; }
.voice-progress .meta { text-align: center; color: var(--muted); margin-top: 8px; }
.voice-fail {
  background: #FFF7ED; border: 1.5px solid #FDBA74; border-radius: 14px;
  padding: 12px 14px; margin-top: 12px;
}
.voice-fail .title { font-weight: 700; color: #9A3412; }
.voice-fail .action { margin-top: 4px; }
.voice-fail .row { margin-top: 12px; flex-wrap: wrap; }
.action-error {
  background: #FFF7ED; border: 1px solid #FDBA74; border-left: 5px solid var(--warn);
  border-radius: 12px; padding: 12px 14px; margin: 12px 0;
}
.action-error .title { font-weight: 700; color: #9A3412; }
.action-error .row { margin-top: 10px; flex-wrap: wrap; }

/* 字号档位选择（老人端「我的」页） */
.scale-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.scale-opt {
  flex: 1 1 90px; min-height: var(--ctl-h); border: 1.5px solid var(--n2);
  background: #fff; border-radius: 10px; font-family: inherit; font-size: 16px;
  color: var(--text); cursor: pointer;
}
.scale-opt.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.scale-opt:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
body.elder .scale-opt { font-size: 18px; }
html[data-ui-scale="large"] body.elder .scale-opt { font-size: 20px; }
html[data-ui-scale="xlarge"] body.elder .scale-opt { font-size: 23px; }

/* ---------- 响应式：运营端窄屏折叠 ---------- */
@media (max-width: 900px) {
  .admin-layout { flex-direction: column; }
  .admin-nav {
    width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px 12px; gap: 6px;
  }
  .admin-nav .nav-title { padding: 0 8px 0 0; font-size: 15px; }
  /* 窄屏导航改成横向排布后仍是点按目标：保持 44px 热区，避免触屏误触 */
  .admin-nav button { flex: 1 1 auto; min-height: 44px; text-align: center; }
  .admin-main { padding: 14px 14px 28px; }
}

/* ---------- 减动效：尊重系统设置 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
