/* 万星门店工作台 · 组件样式 */

/* 按钮：按下轻微回弹 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 11px;
  font-size: 14.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  transition: transform .32s var(--spring), background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: scale(.95); transition-duration: .1s; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.danger-t { color: var(--danger); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
  color: var(--text-2); transition: background .2s, transform .3s var(--spring);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.9); }

/* 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { color: var(--accent); }
.card-body { padding: 16px 20px 20px; }
.clickable { cursor: pointer; transition: transform .3s var(--spring), box-shadow .25s var(--ease), border-color .2s; }
.clickable:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.clickable:active { transform: scale(.985); transition-duration: .1s; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } .g2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g3 { grid-template-columns: 1fr; } }

/* 数字卡 */
.stat { padding: 18px 20px; position: relative; }
.stat .label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .value { font-family: var(--num); font-size: 38px; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .value small { font-size: 17px; margin-left: 2px; color: var(--text-2); }
.stat .foot { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.stat.alert .value { color: var(--danger); }
.stat.hl .value { color: var(--accent-2); }
.stat .bar { height: 4px; border-radius: 4px; background: var(--bg-2); margin-top: 12px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); transition: width .9s var(--ease) .15s; }
@media (max-width: 860px) { .stat { padding: 14px 16px; } .stat .value { font-size: 30px; margin-top: 6px; } }

/* 状态标签 / 徽标 / 小筛选 */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--bg-2); color: var(--text-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.line { background: transparent; border: 1px solid var(--line-2); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; line-height: 1; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.tag .sw { width: 8px; height: 8px; border-radius: 2px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; white-space: nowrap; font-size: 13.5px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s, color .2s, border-color .2s, transform .3s var(--spring);
}
.chip:active { transform: scale(.94); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .n { font-size: 12px; opacity: .7; }

/* 分段选择 */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--bg-2); position: relative; }
.seg button { position: relative; z-index: 1; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; color: var(--text-2); transition: color .2s; white-space: nowrap; }
.seg button.on { color: var(--text); font-weight: 600; }
.seg .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-sm); transition: left .3s var(--ease), width .3s var(--ease); }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }

/* 选项卡（页内二级） */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; padding: 10px 14px 12px; font-size: 14.5px; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color .2s; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); font-weight: 600; }
.tabs .ink { position: absolute; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; transition: left .3s var(--ease), width .3s var(--ease); }
@media (max-width: 860px) { .tabs { margin: 0 -16px 16px; padding: 0 12px; } }

/* 输入 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .lb { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); font-weight: 400; }
.input, .textarea, .select {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--surface); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 38px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar .chips { min-width: 0; max-width: 100%; }
@media (max-width: 860px) { .toolbar { flex-direction: column; align-items: stretch; } .toolbar .search { min-width: 0; } }

/* 开关 */
.switch { width: 42px; height: 24px; border-radius: 12px; background: var(--line-2); position: relative; transition: background .25s; flex: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .3s var(--spring); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

/* 列表行 */
.list { display: flex; flex-direction: column; }
.li {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-top: 1px solid var(--line); transition: background .2s;
}
.li:first-child { border-top: 0; }
.li.clickable:hover { background: var(--surface-2); box-shadow: none; }
.li .main-t { flex: 1; min-width: 0; }
.li .t { font-size: 14.5px; font-weight: 500; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 12.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.li .s .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: .6; }
.li .chev { color: var(--text-3); }
.li-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-2); color: var(--text-2); flex: none; }
.li-ic.accent { background: var(--accent-soft); color: var(--accent-ink); }
.li-ic.ok { background: var(--ok-soft); color: var(--ok); }
.li-ic.danger { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 860px) { .li { padding: 13px 16px; gap: 12px; } }

/* 头像 */
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13.5px; font-weight: 600; color: #fff; flex: none; background: var(--accent); }
.av.sm { width: 26px; height: 26px; font-size: 11.5px; }
.av.lg { width: 48px; height: 48px; font-size: 18px; }
.av-stack { display: flex; }
.av-stack .av { border: 2px solid var(--surface); margin-left: -8px; }
.av-stack .av:first-child { margin-left: 0; }

/* 空状态 */
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty .ic { margin: 0 auto 10px; color: var(--line-2); }
.empty b { display: block; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }

/* 抽屉：电脑从右侧滑入，手机从底部升起 */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(20, 20, 19, .32); opacity: 0; transition: opacity .28s var(--ease); }
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  background: var(--bg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(104%); transition: transform .34s var(--ease);
}
.drawer.show { transform: none; }
.drawer.wide { width: min(680px, 100vw); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { flex: 1; font-size: 17px; font-weight: 600; min-width: 0; }
.drawer-head .grab { display: none; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; overscroll-behavior: contain; }
.drawer-foot { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--bg); }
.drawer-foot .btn { flex: 1; }
@media (max-width: 860px) {
  .drawer, .drawer.wide { top: auto; left: 0; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; transform: translateY(104%); }
  .drawer.full { max-height: none; height: 100%; border-radius: 0; }
  .drawer.show { transform: none; }
  .drawer-head { position: relative; padding-top: 22px; }
  .drawer-head .grab { display: block; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-2); }
  .drawer-body { padding: 16px; }
  .drawer-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}

/* 轻提示 */
.toast-wrap { position: fixed; z-index: 80; left: 50%; top: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-lg);
  animation: toastIn .34s var(--spring) both;
}
.toast .ic { color: var(--accent); }
.toast.out { animation: toastOut .24s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 860px) { .toast-wrap { top: auto; bottom: 96px; } }

/* 完成打勾 */
.done-check { width: 64px; height: 64px; margin: 0 auto; }
.done-check circle { stroke: var(--ok); stroke-width: 2.5; fill: var(--ok-soft); stroke-dasharray: 170; stroke-dashoffset: 170; animation: draw .45s var(--ease) forwards; }
.done-check path { stroke: var(--ok); stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .3s var(--ease) .32s forwards; }
.done-panel { text-align: center; padding: 36px 12px 12px; }
.done-panel h3 { margin-top: 16px; font-size: 18px; animation: rise .3s var(--ease) .4s both; }
.done-panel p { margin-top: 6px; color: var(--text-2); animation: rise .3s var(--ease) .48s both; }
.done-panel .after { animation: rise .3s var(--ease) .56s both; }

/* 勾选框 */
.cbox { width: 22px; height: 22px; border-radius: 7px; border: 1.6px solid var(--line-2); display: grid; place-items: center; flex: none; transition: background .2s, border-color .2s, transform .3s var(--spring); background: var(--surface); }
.cbox svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .25s var(--ease) .05s; }
.cbox.on { background: var(--ok); border-color: var(--ok); transform: scale(1.06); }
.cbox.on svg { stroke-dashoffset: 0; }
.check-row { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 10px; }
.check-row.on { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok-soft) 50%, var(--surface)); }
.check-row.on .t { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }

/* 照片占位（模拟实拍） */
.ph { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg-2); }
.ph svg { width: 100%; height: 100%; display: block; }
.ph .cap { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(20,20,19,.55); color: #fff; font-size: 11.5px; }
.ph.reveal svg { animation: unblur .55s var(--ease) both; }
@keyframes unblur { from { filter: blur(14px) saturate(.6); transform: scale(1.06); opacity: .3; } to { filter: none; transform: none; opacity: 1; } }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }

/* 进度环 */
.ring { width: 76px; height: 76px; position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .bg { stroke: var(--bg-2); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .7s var(--ease); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--num); font-size: 19px; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }

/* 小块信息 */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.note.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* 骨架 / 打字光标 */
.skel { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-2) 25%, var(--surface-2) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; margin-bottom: 10px; }
.caret::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--accent); animation: blink .9s step-end infinite; }
