/* ============================================================
   components.css — 组件样式
   工位卡片 / 像素进度条 / 计时器 / 弹窗 / 通知 / 统计卡
   ============================================================ */

/* ---------- 工位卡片 (核心视觉元素) ---------- */
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

.station-card {
  position: relative;
  background: #fff;
  border: var(--pixel-brd) solid var(--wood);
  /* 略带方感的像素圆角 */
  border-radius: 14px 14px 14px 6px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .4s ease;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 170px;
}
.station-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.station-card:active { transform: translateY(0); }

/* 状态态配色 */
.station-card[data-status="occupied"] {
  background: linear-gradient(160deg, #fff 0%, color-mix(in srgb, var(--idle) 34%, #fff) 100%);
}
.station-card[data-status="paused"] {
  background: linear-gradient(160deg, #fff 0%, color-mix(in srgb, var(--paused) 40%, #fff) 100%);
}
.station-card[data-status="overtime"] {
  background: linear-gradient(160deg, #fff 0%, color-mix(in srgb, var(--overtime) 38%, #fff) 100%);
  border-color: var(--overtime-deep);
  animation: respire 1.6s ease-in-out infinite;
}
@keyframes respire {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--overtime) 40%, transparent); }
  50%     { box-shadow: 0 0 0 10px color-mix(in srgb, var(--overtime) 0%, transparent); }
}

/* 卡头顶部 */
.station-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.station-no { font-family: var(--font-pixel); font-size: 15px; color: var(--wood-dark); }
.station-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.station-type { font-size: 11px; color: var(--ink-faint); }

/* 状态徽标 */
.station-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--cream-2); color: var(--ink-soft);
}
.station-badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.station-card[data-status="idle"] .station-badge .dot { background: var(--idle); }
.station-card[data-status="occupied"] .station-badge .dot { background: var(--timer); animation: blink 1s infinite; }
.station-card[data-status="paused"] .station-badge .dot { background: var(--paused); }
.station-card[data-status="overtime"] .station-badge .dot { background: var(--overtime); animation: blink .7s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.station-card[data-status="idle"] .station-badge { background: color-mix(in srgb, var(--idle) 30%, #fff); color: var(--idle-deep); }

/* 计时主体 */
.station-clock { text-align: center; }
.station-clock .label { font-size: 11px; color: var(--ink-soft); margin-bottom: 2px; }
.station-clock .time { font-family: var(--font-pixel); font-size: 26px; color: var(--ink); letter-spacing: 1px; }
.station-card[data-status="overtime"] .station-clock .time { color: var(--overtime-deep); animation: pulseNum 1s infinite; }
.station-card[data-status="paused"] .station-clock .time { color: var(--paused-deep); }
@keyframes pulseNum { 50% { transform: scale(1.06); opacity: .7; } }

/* 近超时: 闪烁放大 (倒计时1分钟) */
.station-card.near .station-clock .time {
  color: var(--timer-deep); animation: pulseNum .8s infinite;
}
.station-card.near .station-badge { background: color-mix(in srgb, var(--timer) 40%, #fff); color: #7A5A00; }

/* 费用行 */
.station-fee { display: flex; justify-content: space-between; align-items: center; }
.station-fee .fe { font-size: 11px; color: var(--ink-soft); }
.station-fee .fv { font-size: 17px; font-weight: 800; color: var(--ink); }
.station-fee .fv small { font-size: 11px; font-weight: 600; color: var(--ink-faint); }

/* 底部进度条 (像素块跳跃) */
.progress { height: 10px; border-radius: 6px; background: var(--cream-2); overflow: hidden; position: relative; border: 1px solid var(--cream-2); }
.progress .bar {
  height: 100%; border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--timer) 0 9px, var(--timer-deep) 9px 12px);
  transition: width .4s ease;
}
.progress .bar.over { background: repeating-linear-gradient(90deg, var(--overtime) 0 9px, var(--overtime-deep) 9px 12px); }
.progress .bar.paused { background: repeating-linear-gradient(90deg, var(--paused) 0 9px, var(--paused-deep) 9px 12px); }
.station-meta { font-size: 11px; color: var(--ink-faint); text-align: center; }

/* 空工位提示 */
.station-card .idle-hint {
  text-align: center; margin: auto 0; color: var(--idle-deep);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.station-card .idle-hint .mini-btn {
  padding: 8px 18px; border-radius: 999px; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 13px; box-shadow: 2px 2px 0 var(--accent-2);
  border: none; cursor: pointer; transition: transform .15s ease;
}
.station-card .idle-hint .mini-btn:hover { transform: translateY(-2px); }
.station-card .idle-hint .mini-btn:active { transform: translateY(1px); }

/* ---------- 顶部看板统计卡 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: var(--pixel-brd) solid var(--wood); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card .accent-strip { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.stat-card .k { font-size: 12px; color: var(--ink-soft); }
.stat-card .v { font-size: 26px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.stat-card .v small { font-size: 12px; color: var(--ink-faint); font-weight: 600; }
.stat-card .d { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- 弹窗 (毛玻璃) ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(60, 40, 25, 0.38);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--cream); border: var(--pixel-brd) solid var(--wood);
  border-radius: 18px 18px 18px 8px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-pop); animation: popUp .26s cubic-bezier(.2,.9,.3,1.2);
  /* 拼豆板网格暗纹 */
  background-image:
    linear-gradient(color-mix(in srgb, var(--wood) 14%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--wood) 14%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
@keyframes popUp { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 640px; }

.modal-head { padding: 18px 20px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 2px solid color-mix(in srgb, var(--wood) 40%, transparent); }
.modal-head h3 { font-size: 17px; }
.modal-head .x { margin-left: auto; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink-soft); width: 32px; height: 32px; border-radius: 8px; }
.modal-head .x:hover { background: var(--cream-2); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.modal-foot button { flex: 1; }

/* ---------- 表单控件 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field .help { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--wood);
  background: #fff; color: var(--ink); font-size: 14px; font-family: inherit; transition: border .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.input.erred, .select.erred { border-color: var(--overtime-deep); }
.input-err { font-size: 11px; color: var(--overtime-deep); margin-top: 4px; display: none; }
.input-err.show { display: block; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* 分段控件 (包/阶梯/自定义) */
.seg { display: flex; gap: 8px; }
.seg .seg-btn {
  padding: 8px 14px; border-radius: 10px; border: 2px solid var(--wood); background: #fff;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-soft); transition: all .15s ease; flex-wrap: wrap;
}
.seg .seg-btn:hover { border-color: var(--ink-soft); }
.seg .seg-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* 套餐选择 - 彩色豆子 */
.pkg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.pkg-btn {
  position: relative; padding: 14px 8px; border-radius: 12px; border: 2px solid var(--wood);
  background: #fff; cursor: pointer; text-align: center; transition: all .15s ease; box-shadow: 2px 2px 0 var(--wood);
}
.pkg-btn:hover { transform: translateY(-2px); box-shadow: 3px 4px 0 var(--wood); }
.pkg-btn.active { border-color: var(--accent); box-shadow: 2px 3px 0 var(--accent-2); }
.pkg-btn .bean { font-size: 12px; display: block; margin-bottom: 4px; }
.pkg-btn .pk-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.pkg-btn .pk-price { font-size: 15px; font-weight: 800; color: var(--accent); margin-top: 3px; }
.pkg-btn .pk-price small { font-size: 10px; color: var(--ink-faint); }

/* 勾选动画 (像素) */
.bean-row { display: flex; gap: 4px; justify-content: center; margin-top: 3px; }
.bean-row .b { width: 9px; height: 9px; border-radius: 2px; background: var(--timer); opacity: .55; }

/* ---------- 全局通知 toast ---------- */
.toast-wrap { position: fixed; top: calc(var(--topnav-h) + 14px); right: 20px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }

/* ---------- 顶栏用户区 ---------- */
.user-box { display: flex; align-items: center; gap: 10px; margin-left: 16px; padding-left: 16px; border-left: 2px solid var(--wood); }
.user-box .u-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; box-shadow: 2px 2px 0 var(--wood-dark); }
.user-box .u-name { font-size: 14px; font-weight: 700; }
.user-box .logout-btn { color: var(--overtime-deep); border-color: var(--overtime); box-shadow: 2px 2px 0 var(--overtime-deep); background: #fff; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 340px;
  background: #fff; border: 2px solid var(--wood); border-left: 5px solid var(--done);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow-hover);
  font-size: 13px; color: var(--ink); animation: slideIn .25s ease;
}
.toast.over { border-left-color: var(--overtime); }
.toast.warn { border-left-color: var(--timer); }
.toast.out { animation: slideOut .3s forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }

/* 语音提醒横幅 */
.voice-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: none; align-items: center; gap: 10px; background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-pop); font-size: 13px;
}
.voice-bar.show { display: flex; animation: fadeUp .3s ease; }
.voice-bar .vdot { width: 9px; height: 9px; border-radius: 50%; background: var(--done); animation: blink 1s infinite; }

/* 字段时间轴 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content:""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--wood); }
.tl-item { position: relative; padding: 6px 0 6px 12px; }
.tl-item::before { content:""; position: absolute; left: -18px; top: 10px; width: 12px; height: 12px; border-radius: 3px; background: var(--timer); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--wood); }
.tl-item.over::before { background: var(--overtime); }
.tl-item.paused::before { background: var(--paused); }
.tl-item.done::before { background: var(--done); }
.tl-item .tl-t { font-size: 12px; color: var(--ink-faint); }
.tl-item .tl-d { font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---------- 会员选择器 (开台) ---------- */
.member-pick { position: relative; }
.mg-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  max-height: 210px; overflow: auto; background: #fff;
  border: 2px solid var(--wood); border-radius: 12px; box-shadow: var(--shadow-hover);
}
.mg-option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; transition: background .12s ease; }
.mg-option:hover { background: var(--cream-2); }
.mg-option .m-avatar { width: 32px; height: 32px; font-size: 13px; border-radius: 50%; background: var(--accent-2); color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.mg-option .sm { font-size: 11px; color: var(--ink-faint); }
.mg-empty { padding: 12px; color: var(--ink-faint); font-size: 12px; }
#mg-selected { display: flex; align-items: center; flex-wrap: wrap; }

/* ---------- 快速零售 ---------- */
.retail-goods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 220px; overflow: auto; }
.rg-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 2px solid var(--wood); border-radius: 10px; background: #fff; box-shadow: 2px 2px 0 var(--wood); }
.rg-item:hover { border-color: var(--accent); }
.rg-name { font-size: 13px; font-weight: 700; }
.rg-meta { font-size: 11px; color: var(--ink-faint); }
.retail-cart { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: auto; }
.rc-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--wood); border-radius: 10px; background: #fff; }
.rc-item .rc-name { flex: 1; font-size: 13px; font-weight: 600; }
.rc-item .rc-ctrl { display: flex; align-items: center; gap: 8px; }
.rc-item .rc-ctrl .q { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--wood); background: #fff; cursor: pointer; font-size: 14px; font-weight: 700; line-height: 1; }
.rc-item .rc-ctrl .q:hover { border-color: var(--accent); }
.rc-item .rc-sub { width: 64px; text-align: right; font-weight: 700; }
.retail-cart .rm { border: none; background: #ffe9e4; color: var(--overtime-deep); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.retail-total { text-align: right; font-size: 15px; font-weight: 700; margin-top: 8px; }
.retail-total b { color: var(--accent); font-size: 18px; }
