:root {
  --brand: #ff6b35;
  --brand-dark: #e55a2b;
  --brand-light: #fff0e8;
  --success: #07c160;
  --warning: #ff9f1c;
  --danger: #fa5151;
  --info: #3a7afe;
  --text-1: #1a1a1a;
  --text-2: #666666;
  --text-3: #999999;
  --bg-page: #f5f6f8;
  --bg-card: #ffffff;
  --border: #ececec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text-1);
  background: var(--bg-page);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 168px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  border: 1px solid var(--brand);
  background: transparent;
  color: var(--brand);
}

button.ghost {
  background: transparent;
  color: var(--text-2);
}

button:active {
  transform: scale(0.98);
}

.app {
  max-width: 760px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg-page);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.section {
  padding: 16px;
}

.avatar-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 168px;
  align-items: center;
  gap: 14px;
  min-height: 210px;
  margin-bottom: 12px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 107, 53, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #fff0e8 100%);
}

.voice-stop-floating {
  position: static;
  z-index: 2;
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  min-width: 96px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 99, 45, 0.18);
  border-radius: 999px;
  color: #d84618;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 28px rgba(255, 99, 45, 0.2);
  font-size: 15px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.avatar-voice-status {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  margin: -4px 4px 8px;
  padding: 4px 8px;
  color: var(--text-2);
  font-size: 12px;
}

.avatar-voice-status .voice-stop-floating {
  min-width: 88px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 13px;
}

.voice-stop-floating[hidden] {
  display: none;
}

.voice-stop-floating .stop-dot {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  background: linear-gradient(135deg, #ff7a45, #e23f17);
  box-shadow: 0 0 0 6px rgba(255, 99, 45, 0.12);
}

.avatar-copy span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 12px;
}

.avatar-copy h2 {
  margin: 12px 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.avatar-copy p {
  margin: 0;
  color: var(--text-2);
  line-height: 1.5;
}

.avatar-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.avatar-quick-actions button {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.25;
}

.avatar-figure {
  position: relative;
  /* Portrait figure sized so the digital employee's visible height is
     210-260px on phone viewports (head, earpiece and guiding gesture all
     visible, no squashing). object-fit:contain keeps aspect ratio. */
  width: 168px;
  height: 248px;
  justify-self: end;
  align-self: end;
  overflow: visible;
}

.avatar-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 10px 18px rgba(229, 90, 43, 0.16));
}

@media (max-width: 414px) {
  .avatar-figure {
    width: 156px;
    height: 232px;
  }
}

/* ===== P02 UX95 customer-first experience ===== */
:root {
  --brand: #f45b2a;
  --brand-dark: #c93c14;
  --brand-light: #fff1e9;
  --text-1: #241c18;
  --text-2: #6e625c;
  --text-3: #9b8f88;
  --bg-page: #fbf8f5;
  --border: #eee5df;
  --shadow-card: 0 12px 34px rgba(72, 44, 28, 0.07);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
}

body {
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% -160px, rgba(244, 91, 42, 0.1), transparent 360px),
    var(--bg-page);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
}

button,
a,
input,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(244, 91, 42, 0.25);
  outline-offset: 2px;
}

.app {
  width: 100%;
  max-width: 720px;
  background: transparent;
}

.topbar {
  z-index: 45;
  min-height: 68px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(238, 229, 223, 0.82);
  background: rgba(255, 252, 249, 0.92);
  box-shadow: 0 5px 20px rgba(44, 28, 18, 0.04);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  min-width: 0;
}

.brand-lockup > span {
  display: block;
  margin-bottom: 2px;
  color: var(--brand-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.topbar h1 {
  overflow: hidden;
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 16px rgba(40, 26, 18, 0.05);
}

.table-chip.confirmed {
  border-color: rgba(7, 193, 96, 0.22);
  color: #057c40;
  background: #eefaf4;
}

.table-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b7ada7;
  box-shadow: 0 0 0 4px rgba(183, 173, 167, 0.14);
}

.table-chip.confirmed .table-chip-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.13);
}

.section {
  padding: 12px;
}

.avatar-stage {
  grid-template-columns: minmax(0, 1fr) 152px;
  gap: 6px;
  min-height: 326px;
  margin-bottom: 10px;
  padding: 22px 14px 0 18px;
  border: 0;
  border-radius: 26px;
  background:
    radial-gradient(circle at 88% 24%, rgba(255, 181, 130, 0.52), transparent 34%),
    linear-gradient(145deg, #fff 0%, #fff5ee 58%, #ffe7d8 100%);
  box-shadow: var(--shadow-card);
}

.avatar-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: inherit;
}

.avatar-copy {
  z-index: 2;
  align-self: start;
  min-width: 0;
}

.avatar-copy > span {
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid rgba(244, 91, 42, 0.1);
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.avatar-copy h2 {
  max-width: 230px;
  margin: 13px 0 7px;
  font-size: clamp(25px, 7vw, 34px);
  font-weight: 950;
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.avatar-copy p {
  max-width: 226px;
  color: #695b54;
  font-size: 14px;
  line-height: 1.55;
}

.avatar-quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: min(240px, calc(100vw - 178px));
  margin-top: 16px;
}

.avatar-quick-actions button {
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid rgba(244, 91, 42, 0.2);
  border-radius: 13px;
  color: #9f3516;
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(112, 55, 25, 0.04);
}

.avatar-figure {
  width: 152px;
  height: 250px;
  margin-right: -2px;
}

.avatar-figure img {
  filter: drop-shadow(0 16px 22px rgba(110, 56, 30, 0.18));
}

.avatar-badge {
  right: 2px;
  bottom: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(244, 91, 42, 0.12);
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(96, 48, 24, 0.1);
}

.avatar-mouth {
  display: none;
}

.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.home-shortcuts a,
.home-shortcuts button {
  display: grid;
  min-width: 0;
  min-height: 64px;
  place-content: center;
  gap: 2px;
  padding: 8px 5px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 7px 20px rgba(72, 44, 28, 0.05);
  text-align: center;
  text-decoration: none;
}

.home-shortcuts span {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 900;
}

.home-shortcuts strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  margin-bottom: 10px;
  padding: 18px;
  border: 1px solid rgba(238, 229, 223, 0.86);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 26px rgba(72, 44, 28, 0.045);
}

.panel h2,
.panel h3 {
  margin: 0;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin-top: 2px;
  font-size: 21px;
  font-weight: 950;
  letter-spacing: -0.025em;
}

.section-kicker {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-pill,
.menu-promise {
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #057c40;
  background: #eefaf4;
  font-size: 11px;
  font-weight: 800;
}

.live-pill i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--success);
}

.menu-promise {
  color: var(--brand-dark);
  background: var(--brand-light);
}

.ai-panel {
  overflow: hidden;
}

.chat-log {
  min-height: 92px;
  max-height: 290px;
  padding: 3px 1px;
}

.msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.55;
}

.msg.ai {
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  background: #fffaf7;
}

.msg.user {
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, #f76b3b, #ef4e1c);
}

.chat-form {
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbf8f5;
}

.chat-form input {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font-size: 14px;
}

.chat-form button {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 900;
}

.voice-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.voice-bar span {
  grid-column: 1 / -1;
  padding-left: 2px;
  color: var(--text-3);
  font-size: 11px;
}

.voice-btn {
  min-width: 0;
  min-height: 44px;
  padding: 7px 4px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-question-list {
  gap: 7px;
}

.quick-question-list button {
  min-height: 44px;
  padding: 6px 10px;
  border-color: var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: #fff;
  font-size: 12px;
}

.search-wrap {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  height: 50px;
  margin: 13px 0 12px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--text-3);
  background: #fbf8f5;
}

.search-wrap > span {
  font-size: 24px;
  line-height: 1;
}

.dish-search {
  height: 48px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 15px;
  outline: 0;
}

.dish {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 13px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.dish-visual {
  position: relative;
  width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 34% 28%, #ffd09f 0 9%, transparent 10%),
    radial-gradient(circle at 65% 62%, #a64c25 0 26%, transparent 27%),
    linear-gradient(145deg, #fff1df, #ffd1b7);
}

.dish-visual::after {
  content: "555";
  position: absolute;
  right: 9px;
  bottom: 8px;
  color: rgba(112, 47, 20, 0.62);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.dish-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: inherit;
  object-fit: cover;
}

.dish-content {
  min-width: 0;
}

.dish-title strong {
  font-size: 17px;
  font-weight: 950;
}

.price {
  font-size: 17px;
  font-weight: 950;
}

.dish .muted {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--text-2);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dish .tags {
  margin-top: 7px;
}

.dish .tag {
  padding: 3px 7px;
  font-size: 10px;
}

.dish-actions {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 7px;
  margin-top: 9px;
}

.dish-actions button {
  min-height: 42px;
  border-radius: 12px;
  font-size: 12px;
}

.dish-add {
  box-shadow: 0 8px 16px rgba(244, 91, 42, 0.18);
}

.shop-head h2 {
  font-size: 19px;
  font-weight: 950;
}

.kv {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 9px 10px;
  font-size: 13px;
}

.kv strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feedback-panel {
  padding: 0;
}

.feedback-panel summary {
  padding: 17px 18px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.feedback-panel summary::-webkit-details-marker {
  display: none;
}

.feedback-panel summary::after {
  content: "＋";
  float: right;
  color: var(--brand-dark);
}

.feedback-panel[open] summary::after {
  content: "－";
}

.feedback-panel form,
.feedback-panel .status {
  margin-right: 18px;
  margin-left: 18px;
}

.feedback-panel form {
  margin-bottom: 16px;
}

.service-call-dock {
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 38;
  gap: 0;
}

body.cart-has-items .service-call-dock {
  bottom: calc(82px + env(safe-area-inset-bottom));
}

.service-call-float {
  min-width: 0;
  min-height: 52px;
  padding: 7px 12px 7px 7px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(190, 54, 17, 0.28);
}

.service-call-icon {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.service-call-float #serviceCallText {
  max-width: 94px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-call-dock > .service-call-hint {
  display: none;
}

.cart-bar {
  bottom: calc(10px + env(safe-area-inset-bottom));
  grid-template-columns: minmax(0, 1.15fr) minmax(118px, 0.85fr);
  width: min(696px, calc(100vw - 24px));
  padding: 7px;
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(48, 26, 14, 0.18);
}

.cart-bar button {
  min-height: 52px;
  border-radius: 13px;
  font-size: 14px;
}

.order-panel,
.service-call-panel,
.flow-panel {
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -18px 54px rgba(35, 22, 16, 0.24);
}

.order-close,
.service-call-close,
.flow-close {
  border-color: var(--border);
  color: var(--text-2);
  font-weight: 800;
}

.order-panel h2,
.service-call-panel h2,
.flow-panel h2 {
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 90;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  color: #fff;
  background: rgba(36, 28, 24, 0.94);
  box-shadow: 0 12px 28px rgba(36, 28, 24, 0.22);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.toast[hidden] {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 152px;
    min-height: 326px;
  }

  .avatar-quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voice-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .service-call-dock {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  body.cart-has-items .service-call-dock {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .cart-bar {
    grid-template-columns: minmax(0, 1.15fr) minmax(118px, 0.85fr);
    bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .dish-actions {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

@media (max-width: 414px) {
  .section {
    padding: 10px;
  }

  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 142px;
    min-height: 314px;
    padding: 20px 10px 0 15px;
  }

  .avatar-copy h2 {
    font-size: 27px;
  }

  .avatar-copy p {
    font-size: 13px;
  }

  .avatar-quick-actions {
    width: calc(100vw - 176px);
  }

  .avatar-figure {
    width: 142px;
    height: 232px;
  }

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .dish {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 11px;
  }

  .dish-visual {
    width: 88px;
    height: 94px;
  }
}

/* P02 customer-first hierarchy: one prominent first-screen action and voice
   controls disclosed only when requested. */
.hero-primary {
  width: min(220px, 100%);
  min-height: 52px;
  margin-top: 16px;
  padding: 0 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f76b3b, #e94c1b);
  box-shadow: 0 12px 24px rgba(229, 76, 27, 0.22);
  font-size: 17px;
  font-weight: 900;
}

.voice-settings {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.voice-settings summary {
  min-height: 44px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 44px;
}

.voice-settings .voice-bar {
  margin-top: 6px;
}

@media (max-width: 720px) {
  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 124px;
    min-height: 228px;
    padding: 18px 10px 0 16px;
  }

  .avatar-copy h2 {
    margin-top: 10px;
    font-size: clamp(24px, 7vw, 29px);
  }

  .avatar-figure {
    width: 124px;
    height: 188px;
  }

  .avatar-badge {
    bottom: 6px;
    max-width: 116px;
    font-size: 10px;
  }
}

@media (max-width: 375px) {
  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 112px;
    min-height: 220px;
    padding-left: 14px;
  }

  .avatar-copy p {
    font-size: 12px;
    line-height: 1.45;
  }

  .avatar-figure {
    width: 112px;
    height: 174px;
  }
}

@media (max-width: 375px) {
  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 130px;
    min-height: 304px;
  }

  .avatar-copy h2 {
    font-size: 25px;
  }

  .avatar-quick-actions {
    width: calc(100vw - 158px);
  }

  .avatar-quick-actions button {
    padding: 6px 4px;
    font-size: 11px;
  }

  .avatar-figure {
    width: 130px;
    height: 218px;
  }

  .home-shortcuts strong {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 375px) {
  .avatar-figure {
    width: 144px;
    height: 214px;
  }
}

.avatar-mouth {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 20px;
  height: 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #7d3b2f;
  opacity: 0;
}

.avatar-badge {
  position: absolute;
  right: 4px;
  bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 12px;
  /* Revised V5: badge carries a short label only (set in JS). Width is enough
     for the short labels; no ellipsis so a label can never be truncated to
     "…" (previous bug). The badge sits at the figure's bottom-right and does
     not overlap face / earpiece / gesture / badge-tag / apron (all upper). */
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.avatar-stage[data-state="welcome"] .avatar-figure::after,
.avatar-stage[data-state="recommending"] .avatar-figure::after,
.avatar-stage[data-state="closing"] .avatar-figure::after {
  position: absolute;
  right: -8px;
  top: 16px;
  min-width: 30px;
  min-height: 30px;
  padding: 5px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(229, 90, 43, 0.16);
}

.avatar-stage[data-state="welcome"] .avatar-figure::after {
  content: "hi";
  animation: hand-wave 0.75s ease-in-out infinite;
}

.avatar-stage[data-state="recommending"] .avatar-figure::after {
  content: "荐";
  animation: recommend-pop 0.8s ease-in-out infinite;
}

.avatar-stage[data-state="closing"] .avatar-figure::after {
  content: "谢";
}

.avatar-stage[data-state="thinking"] .avatar-figure {
  animation: avatar-wait 1.4s ease-in-out infinite;
}

.avatar-stage[data-state="welcome"] .avatar-figure {
  animation: avatar-welcome 1.1s ease-in-out infinite;
}

.avatar-stage[data-state="speaking"] .avatar-figure {
  animation: avatar-speak 0.9s ease-in-out infinite;
}

.avatar-stage[data-state="recommending"] .avatar-figure {
  animation: avatar-recommend 0.8s ease-in-out infinite;
}

.avatar-stage[data-state="closing"] .avatar-figure {
  animation: avatar-close 1s ease-in-out 1;
}

.avatar-stage[data-state="welcome"] .avatar-mouth,
.avatar-stage[data-state="speaking"] .avatar-mouth,
.avatar-stage[data-state="recommending"] .avatar-mouth {
  opacity: 1;
}

.avatar-stage[data-mouth="1"] .avatar-mouth {
  width: 18px;
  height: 5px;
  border-radius: 999px;
}

.avatar-stage[data-mouth="2"] .avatar-mouth {
  width: 16px;
  height: 11px;
  border-radius: 48%;
}

.avatar-stage[data-mouth="3"] .avatar-mouth {
  width: 22px;
  height: 8px;
  border-radius: 50%;
}

.avatar-stage[data-mouth="4"] .avatar-mouth {
  width: 14px;
  height: 15px;
  border-radius: 50%;
}

.avatar-stage[data-mouth="0"] .avatar-mouth {
  opacity: 0;
}

@keyframes avatar-wait {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes avatar-welcome {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(-1deg); }
}

@keyframes avatar-speak {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.015); }
}

@keyframes avatar-recommend {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.025); }
}

@keyframes avatar-close {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(5px) scale(0.99); }
}

@keyframes hand-wave {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(-8deg) scale(1.05); }
}

@keyframes recommend-pop {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.08); }
}

.panel {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.shop-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: none;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.dish-image {
  display: none;
  width: 100%;
  max-height: 220px;
  margin: 10px 0;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.muted {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}

.kv {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
}

.kv span:nth-child(odd) {
  color: var(--text-2);
}

.dish,
.campaign,
.merchant-row {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.dish:first-child,
.campaign:first-child,
.merchant-row:first-child {
  border-top: 0;
}

.dish-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.price {
  color: var(--brand-dark);
  font-weight: 700;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sales-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.sales-actions .ai-action {
  width: 100%;
  min-height: 46px;
  padding: 10px 8px;
  white-space: normal;
  line-height: 1.25;
}

.sales-actions .primary-action {
  grid-column: 1 / -1;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.sales-actions .conversion-action:not(.primary-action) {
  border-color: var(--brand-dark);
  color: var(--brand-dark);
  font-weight: 600;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 12px;
}

.knowledge-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}

.knowledge-row {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.knowledge-row strong {
  display: block;
  margin-bottom: 6px;
}

.knowledge-row p {
  margin: 0 0 6px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.knowledge-row small {
  color: var(--brand-dark);
}

.knowledge-row .delete-knowledge {
  width: 100%;
  margin-top: 8px;
  border-color: var(--danger);
  color: var(--danger);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voice-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto)) 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--brand-light);
}

.voice-bar span {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}

.voice-btn {
  min-height: 38px;
  padding: 8px 11px;
  white-space: nowrap;
}

.demo-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.demo-primary {
  width: 100%;
  margin: 8px 0 12px;
  min-height: 46px;
  font-size: 16px;
  font-weight: 700;
}

.demo-step {
  min-height: 48px;
  padding: 8px 10px;
  line-height: 1.25;
}

.chat-log {
  display: flex;
  min-height: 120px;
  max-height: 320px;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-line;
}

.msg.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
}

.msg.ai {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
}

.msg.thinking {
  color: var(--brand-dark);
  background: var(--brand-light);
}

.recommend-card-list {
  display: grid;
  gap: 8px;
  max-width: 92%;
}

.recommend-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  min-height: 86px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-1);
  text-align: left;
}

.reservation-box {
  display: grid;
  gap: 8px;
  max-width: 92%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--brand-light);
}

.reservation-box p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.reservation-box textarea {
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

.recommend-card img {
  width: 72px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--brand-light);
}

.recommend-card span {
  display: grid;
  gap: 4px;
}

.recommend-card strong {
  font-size: 14px;
}

.recommend-card em {
  color: var(--brand-dark);
  font-style: normal;
  font-weight: 700;
}

.recommend-card small {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 8px;
}

.chat-form input,
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-1);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  color: var(--text-2);
  font-size: 13px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.feedback-form {
  display: grid;
  gap: 10px;
}

.feedback-form textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.case-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.owner-reminders {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.owner-reminders div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--brand-light);
}

.owner-reminders span {
  display: block;
  color: var(--text-2);
  font-size: 13px;
}

.owner-reminders strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-dark);
  font-size: 20px;
  line-height: 1.35;
}

.case-summary div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.case-summary span {
  display: block;
  color: var(--text-2);
  font-size: 13px;
}

.case-summary strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-dark);
  font-size: 20px;
  line-height: 1.3;
}

.metric {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--brand-light);
}

.metric span {
  display: block;
  color: var(--text-2);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--brand-dark);
  font-size: 24px;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.funnel {
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.funnel div {
  position: relative;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.funnel div:not(:last-child)::after {
  content: ">";
  position: absolute;
  top: 50%;
  right: -9px;
  transform: translateY(-50%);
  color: var(--text-3);
  font-weight: 700;
}

.funnel span {
  display: block;
  color: var(--text-2);
  font-size: 13px;
}

.funnel strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-dark);
  font-size: 24px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 16px;
  border-right: 1px solid var(--border);
  background: #fff;
}

.content {
  padding: 16px;
}

.status {
  min-height: 22px;
  color: var(--success);
  font-size: 13px;
}

.danger-text {
  color: var(--danger);
}

.service-call-dock {
  position: fixed;
  right: 14px;
  bottom: 104px;
  z-index: 28;
  width: auto;
  display: grid;
  justify-items: end;
  gap: 4px;
  pointer-events: none;
}

.table-check,
.service-call-float,
.service-call-hint {
  pointer-events: auto;
}

.table-check {
  padding: 12px;
  border: 1px solid rgba(255, 99, 45, 0.22);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.table-check span {
  display: block;
  margin-bottom: 8px;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
}

.table-check-row {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
}

.table-check-row input {
  min-width: 0;
  height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 17px;
}

.table-check-row button {
  min-height: 48px;
}

.table-check-note {
  margin: 8px 0 0 !important;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}

.service-call-float {
  display: grid;
  grid-template-columns: 32px auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  max-width: min(190px, calc(100vw - 28px));
  padding: 8px 14px 8px 9px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #ff7a45 0%, #ff4f22 100%);
  box-shadow: 0 14px 28px rgba(255, 99, 45, 0.3);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.service-call-float:disabled {
  opacity: 0.72;
  color: #fff;
  background: linear-gradient(135deg, #b7b7b7, #8e8e8e);
  box-shadow: 0 10px 22px rgba(40, 40, 40, 0.16);
}

.service-call-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #ff5b2f;
  background: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.service-call-float:disabled .service-call-icon {
  color: #777;
  background: rgba(255, 255, 255, 0.9);
}

.service-call-hint {
  margin: 0;
  max-width: min(190px, calc(100vw - 28px));
  padding: 4px 9px;
  border-radius: 999px;
  color: #9a4b2f;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(48, 28, 20, 0.1);
  font-size: 11px;
  text-align: center;
}

.service-call-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.42);
}

.service-call-sheet[hidden] {
  display: none;
}

.service-call-panel {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 24px 18px max(24px, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.18);
}

.service-call-panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.service-call-panel p {
  margin: 0 0 14px;
  color: var(--text-2);
}

.service-call-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 54px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  color: var(--brand-dark);
  background: #fff;
}

.service-call-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.service-call-options button {
  min-height: 52px;
  border: 1px solid var(--border);
  color: var(--text-1);
  background: #fff;
}

.service-call-options button.active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-light);
}

.service-call-confirm {
  width: 100%;
  min-height: 54px;
  border-radius: 14px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #ff7a45, #ff4f22);
  box-shadow: 0 12px 24px rgba(255, 99, 45, 0.22);
  font-size: 17px;
  font-weight: 900;
}

.service-call-confirm:disabled {
  opacity: 0.55;
  box-shadow: none;
}

.service-call-result {
  min-height: 22px;
  padding-top: 10px;
  color: var(--brand-dark);
  font-weight: 700;
}

/* Revised V5: 30s cooldown progress bar (server cooldown_until driven). */
.cooldown-progress[hidden] {
  display: none;
}

.cooldown-progress {
  margin-top: 12px;
}

.cooldown-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 99, 45, 0.12);
  overflow: hidden;
}

.cooldown-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff7a45, #e23f17);
  /* width is set by JS each second based on server cooldown_until. The
     transition gives a smooth shrink; disabled under reduced-motion below. */
  transition: width 0.9s linear;
}

.cooldown-text {
  margin: 8px 0 0;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .cooldown-bar-fill {
    transition: none;
  }
}

.dish-search {
  width: 100%;
  height: 48px;
  margin: 10px 0 16px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
}

.dish-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.dish-actions button {
  width: 100%;
  min-height: 48px;
  font-weight: 800;
}

.dish-add {
  background: linear-gradient(135deg, #ff7a45, #ff4f22);
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 82px;
  z-index: 35;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(112px, 0.75fr);
  gap: 8px;
  width: min(728px, calc(100vw - 24px));
  padding: 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 99, 45, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 28px rgba(40, 24, 16, 0.14);
  backdrop-filter: blur(12px);
}

.cart-bar[hidden] {
  display: none;
}

.cart-bar button {
  min-width: 0;
  min-height: 52px;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 900;
}

.cart-bar button:first-child {
  border: 1px solid var(--border);
  color: var(--text-1);
  background: #fff;
}

.order-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.46);
}

.order-sheet[hidden] {
  display: none;
}

.order-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  margin: 0 auto;
  padding: 24px 18px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  background: #fff;
  box-shadow: 0 -20px 48px rgba(0, 0, 0, 0.2);
}

.order-panel h2 {
  margin: 0 72px 18px 0;
  font-size: 22px;
}

.order-close {
  position: absolute;
  top: 16px;
  right: 16px;
  min-width: 58px;
  min-height: 44px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fff;
}

.order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.order-item strong,
.order-item em {
  display: block;
}

.order-item em {
  margin-top: 4px;
  color: var(--text-2);
  font-style: normal;
}

.order-qty {
  display: grid;
  grid-template-columns: 44px 44px;
  gap: 8px;
}

.order-qty button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 20px;
  font-weight: 900;
}

.order-total {
  display: block;
  margin: 16px 0;
  color: var(--brand-dark);
  font-size: 20px;
}

.order-submit,
.order-back-ai {
  width: 100%;
  min-height: 54px;
  margin-top: 12px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 900;
}

.order-submit:disabled {
  opacity: 0.55;
  box-shadow: none;
}

@media (max-width: 720px) {
  .avatar-stage {
    /* Widen the figure column so the 210-260px portrait sits without squashing
       and never overlaps the left-hand copy / quick-action buttons. */
    grid-template-columns: 1fr 168px;
    min-height: 260px;
  }

  .avatar-copy h2 {
    font-size: 21px;
  }

  /* NOTE: do NOT shrink .avatar-figure here. The base + 414/375 rules above
     already size it to 214-248px visible height; shrinking here would defeat
     the phone-viewport sizing requirement. */

  .avatar-quick-actions {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .metric-grid,
  .case-summary,
  .owner-reminders,
  .funnel,
  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .service-call-dock {
    right: 12px;
    bottom: 150px;
  }

  .table-check {
    padding: 8px;
  }

  .service-call-options {
    grid-template-columns: 1fr;
  }

  .funnel div::after {
    display: none;
  }

  .voice-bar {
    grid-template-columns: 1fr;
  }

  .voice-btn {
    width: 100%;
  }

  .demo-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-bar {
    grid-template-columns: 1fr;
    bottom: 74px;
  }

  .cart-bar button {
    min-height: 48px;
  }

  .dish-actions {
    grid-template-columns: 1fr;
  }
}

/* ===== P02 Revised V2 下单/支付/订单查询流程弹层 ===== */
.flow-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.46);
}

.flow-sheet[hidden] {
  display: none;
}

.flow-panel {
  position: relative;
  width: min(520px, 100%);
  max-width: 100vw;
  max-height: 88vh;
  margin: 0 auto;
  padding: 24px 18px max(28px, env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  background: #fff;
  box-shadow: 0 -20px 48px rgba(0, 0, 0, 0.2);
}

.flow-panel h2 {
  margin: 0 72px 18px 0;
  font-size: 22px;
}

.flow-close {
  position: absolute;
  top: 16px;
  right: 16px;
  min-width: 58px;
  min-height: 44px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fff;
}

.flow-close[hidden] {
  display: none;
}

.flow-hint {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}

.flow-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.flow-actions button {
  min-height: 48px;
  border-radius: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.flow-actions .primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.flow-actions .secondary {
  border: 1.5px solid #f0a17f;
  color: var(--brand-dark);
  background: #fff;
}

.flow-actions button[disabled] {
  opacity: 0.5;
}

.flow-status {
  display: grid;
  gap: 10px;
}

.flow-status-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--text-2);
}

.flow-status-item strong {
  display: block;
  color: var(--text-1);
}

.flow-status-item em {
  font-style: normal;
  font-size: 13px;
  color: var(--text-3);
  word-break: break-word;
}

.flow-status-item .dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f4f4f4;
  color: #aaa;
  font-size: 14px;
  font-weight: 800;
}

.flow-status-item.done .dot {
  background: #e8f7ef;
  color: var(--success);
}

.flow-status-item.active .dot {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #ffd8c7;
  border-top-color: var(--brand);
  animation: szr-spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes szr-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== 响应式：375/390/414 无横向溢出，关键按钮 >=44px ===== */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.app,
main,
.section,
.panel,
.flow-panel,
.order-panel,
.service-call-panel,
.cart-bar,
.voice-bar,
.chat-form,
.dish-search {
  max-width: 100%;
  box-sizing: border-box;
}

img {
  max-width: 100%;
}

button {
  min-height: 44px;
}

@media (max-width: 414px) {
  .flow-panel,
  .order-panel,
  .service-call-panel {
    width: 100vw;
    max-width: 100vw;
    border-radius: 16px 16px 0 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .flow-actions,
  .dish-actions {
    grid-template-columns: 1fr;
  }

  .flow-panel h2,
  .order-panel h2 {
    font-size: 20px;
  }
}

/* Final mobile hierarchy overrides. */
@media (max-width: 720px) {
  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 124px;
    min-height: 228px;
    padding: 18px 10px 0 16px;
  }

  .avatar-copy h2 {
    margin-top: 10px;
    font-size: clamp(24px, 7vw, 29px);
  }

  .avatar-figure {
    width: 124px;
    height: 188px;
  }
}

@media (max-width: 375px) {
  .avatar-stage {
    grid-template-columns: minmax(0, 1fr) 112px;
    min-height: 220px;
    padding-left: 14px;
  }

  .avatar-figure {
    width: 112px;
    height: 174px;
  }
}

.table-chip,
.voice-btn,
.quick-question-list button {
  min-height: 44px;
}

/* ===== 2026-07-28 mobile task workspace ===== */
body {
  padding-bottom: calc(142px + env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.header-service {
  min-width: 48px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.app-view[hidden],
.spec-sheet[hidden] {
  display: none !important;
}

#aiView {
  padding-top: 10px;
}

#aiView .avatar-stage {
  min-height: 150px;
  margin-bottom: 8px;
  padding: 16px 110px 14px 16px;
  grid-template-columns: 1fr;
  overflow: hidden;
}

#aiView .avatar-copy h2 {
  max-width: 260px;
  margin: 8px 0 5px;
  font-size: clamp(22px, 6.4vw, 28px);
}

#aiView .avatar-copy p {
  max-width: 240px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

#aiView .avatar-figure {
  position: absolute;
  right: 4px;
  bottom: -6px;
  width: 108px;
  height: 152px;
}

#aiView .avatar-badge {
  display: none;
}

#aiAssistantPanel {
  padding: 14px;
}

#aiAssistantPanel .chat-log:empty {
  display: none;
}

.chat-form {
  min-height: 54px;
  border-width: 2px;
  border-color: rgba(244, 91, 42, .28);
  background: #fff;
  box-shadow: 0 8px 24px rgba(82, 38, 16, .07);
}

.chat-form button {
  min-width: 64px;
  color: #fff;
  background: var(--brand);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.quick-grid button {
  padding: 9px 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-1);
  background: #fffaf6;
  font-size: 12px;
  font-weight: 800;
}

.ai-secondary-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.ai-secondary-actions .hero-primary {
  width: auto;
  margin: 0;
}

.ai-secondary-actions .voice-settings {
  grid-column: 1 / -1;
}

.ai-answer-details {
  margin: 2px 0 8px;
  color: var(--text-2);
  font-size: 12px;
}

.ai-answer-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
}

.ai-answer-details p {
  margin: 0;
  padding: 10px;
  border-radius: 12px;
  background: #fffaf6;
  white-space: pre-line;
}

.retry-message button {
  display: block;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 16px;
  border: 1px solid var(--brand);
  border-radius: 12px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 800;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.dish-search {
  width: 100%;
  border: 0 !important;
  outline: 0;
  background: transparent;
}

#menuFilters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 12px;
  scrollbar-width: none;
}

#menuFilters::-webkit-scrollbar {
  display: none;
}

#menuFilters .menu-filter {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 999px;
}

.service-call-dock {
  display: none !important;
}

#menuFilters .menu-filter[aria-pressed="true"] {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.dish {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
}

.dish-visual {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  overflow: hidden;
  background: #f5efea;
}

.dish-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-content > .muted {
  display: -webkit-box;
  margin: 5px 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dish-content > .tags {
  display: none;
}

.dish-actions {
  grid-template-columns: auto 1fr;
}

.bottom-nav {
  position: fixed;
  z-index: 80;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px max(10px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.97);
  box-shadow: 0 -8px 28px rgba(54, 31, 20, .09);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  position: relative;
  display: grid;
  min-height: 54px;
  place-items: center;
  gap: 1px;
  border: 0;
  color: var(--text-3);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav button > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  font-size: 13px;
}

.bottom-nav button.active {
  color: var(--brand-dark);
}

.bottom-nav button.active > span {
  color: #fff;
  background: var(--brand);
}

.bottom-nav i {
  position: absolute;
  top: 1px;
  left: 55%;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #fff;
  background: #e43d30;
  font-size: 10px;
  font-style: normal;
}

.cart-bar {
  z-index: 75;
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: min(680px, calc(100vw - 20px));
}

.workspace-primary {
  width: 100%;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.order-empty {
  padding: 24px 8px;
  text-align: center;
}

.order-empty strong {
  font-size: 18px;
}

.spec-sheet {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(35, 24, 19, .48);
}

.spec-panel {
  width: min(720px, 100%);
  max-height: 88vh;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -16px 50px rgba(40, 24, 16, .2);
}

.spec-panel h2 {
  margin: 8px 50px 4px 0;
}

.spec-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.spec-fields label {
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
}

.spec-fields select {
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-1);
  background: #fffaf6;
}

.spec-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  font-size: 14px;
}

.spec-price-row strong {
  color: var(--brand-dark);
  font-size: 22px;
}

@media (max-width: 390px) {
  .topbar {
    padding-right: 10px;
    padding-left: 10px;
  }
  .table-chip {
    max-width: 108px;
    padding: 0 9px;
  }
  #topTableText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .section {
    padding-right: 10px;
    padding-left: 10px;
  }
  .panel {
    padding: 14px;
  }
}

/* ===== 84-point real-page remediation ===== */
body.modal-open .cart-bar {
  display: none !important;
}

#aiAssistantPanel .chat-log {
  max-height: min(330px, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.recommend-card-list {
  max-width: 100%;
}

.recommend-card {
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 70px;
  padding: 8px;
}

.recommend-card img {
  width: 54px;
  height: 54px;
}

.recommend-card small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.ai-next-step {
  display: grid;
  gap: 8px;
  width: 100%;
}

.ai-primary-next .ai-action {
  width: 100%;
  color: #fff;
  background: var(--brand);
}

.ai-next-step details {
  padding: 0;
}

.ai-next-step summary {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
}

.ai-more-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.ai-next-step details:not([open]) .ai-more-actions {
  display: none;
}

.spec-hint {
  display: block;
  margin: 4px 0 7px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
}

.cart-options-grid {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  margin-top: 10px;
}

.cart-options-grid label {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
}

.cart-options-grid select {
  width: 100%;
  min-height: 44px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf6;
}

.order-item {
  align-items: start;
}

.order-item > span:first-child {
  min-width: 0;
}

#ordersView .panel {
  margin-bottom: 0;
}

#ordersView .order-empty {
  max-width: 360px;
  margin: 0 auto;
  padding: 14px 8px 8px;
}

#ordersView .order-empty p {
  margin: 8px 0 14px;
}

@media (max-width: 375px) {
  .spec-fields {
    grid-template-columns: 1fr;
  }

  .order-item {
    grid-template-columns: 1fr;
  }

  .order-qty {
    justify-self: end;
  }
}
