:root {
  --page: #f5f7fa;
  --surface: #ffffff;
  --ink: #1d2938;
  --muted: #7d8998;
  --line: #e4e9ef;
  --blue: #2f72d6;
  --blue-soft: #eaf2ff;
  --green: #209765;
  --danger: #bd6b49;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.work-order-open { overflow: hidden; }
body.return-address-open { overflow: hidden; }

button, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, textarea:focus-visible { outline: 2px solid rgba(47, 114, 214, .45); outline-offset: 2px; }

.customer-app {
  width: min(100%, 640px);
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.customer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
}

.brand-copy { min-width: 0; flex: 1; }
.brand-copy h1 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 750; }
.brand-copy p { display: flex; align-items: center; gap: 5px; margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.channel-label { color: var(--blue); background: var(--blue-soft); border-radius: 5px; padding: 5px 7px; font-size: 10px; white-space: nowrap; }

.conversation {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px 10px;
  background: #fbfcfd;
  overscroll-behavior: contain;
}

/* Keep a short conversation anchored above the composer without affecting
   scrolling once the message list becomes taller than the viewport. */
.conversation::before { content: ""; flex: 1 1 auto; min-height: 0; }
.conversation > * { flex: 0 0 auto; }

.day-note { margin: 0 auto 16px; color: #a2acb8; text-align: center; font-size: 10px; }
.message { display: flex; align-items: flex-start; gap: 8px; width: 100%; max-width: 100%; min-width: 0; margin: 0 0 14px; }
.message.user { flex-direction: row-reverse; }
.message-avatar { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #dceaff; color: #37649c; font-size: 11px; font-weight: 750; }
.message-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.message.assistant .message-avatar { background: #e2f4eb; color: var(--green); }
.message.agent .message-avatar { background: #fff0d8; color: #a56a1f; }
.message.system { justify-content: center; align-items: center; margin: 4px auto 14px; }
.message.system .message-avatar { display: none; }
.message.system .message-body { max-width: 88%; }
.message.system .message-bubble { padding: 6px 12px; border: 0; border-radius: 8px; background: #fff; color: #9aa0a8; text-align: center; font-size: 12px; line-height: 1.5; box-shadow: 0 1px 4px rgba(31, 42, 57, .04); }
.message.system .message-meta { display: none; }
.message-body { min-width: 0; max-width: min(calc(100% - 36px), 460px); overflow: hidden; }
.message-bubble { min-width: 0; max-width: 100%; overflow-wrap: anywhere; padding: 9px 11px; border: 1px solid #e3e8ee; border-radius: 4px 9px 9px 9px; background: #fff; color: #405066; font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.message.user .message-bubble { border-color: #d7e5fb; border-radius: 9px 4px 9px 9px; background: var(--blue-soft); color: #345779; }
.message.agent .message-bubble { border-color: #f0ddba; background: #fffdf8; color: #5f4b31; }
.message-meta { margin-top: 3px; color: #a4aeba; font-size: 10px; }
.message.user .message-meta { text-align: right; }
.message-meta.escalate { color: var(--danger); }
.message-read-state { margin-left: 6px; font-weight: 650; }
.message-read-state.unread { color: #d89a32; }
.message-read-state.read { color: #a8adb4; }

.typing .message-bubble { color: var(--muted); }

.quick-replies {
  display: flex;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 14px 7px;
  border-top: 1px solid var(--line);
  background: #fff;
  scrollbar-width: none;
}
.quick-replies::-webkit-scrollbar { display: none; }
.quick-replies button { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #dbe4ef; border-radius: 6px; background: #fff; color: #58708d; font-size: 11px; white-space: nowrap; }
.quick-replies button:active { background: var(--blue-soft); border-color: #bad0ef; }

.composer { flex: 0 0 auto; min-width: 0; max-width: 100%; padding: 8px 12px max(11px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.image-preview { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 0 0 7px; padding: 5px 7px; border: 1px solid #dce5ef; border-radius: 6px; background: #f8fbff; color: #64758a; font-size: 10px; }
.image-preview img, .image-preview video { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 4px; object-fit: cover; }
.image-preview .pending-media { width: 34px; height: 34px; }
.image-preview span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview button { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; margin-left: auto; border-radius: 5px; background: transparent; color: #8391a2; }
.image-preview button { font-size: 18px; line-height: 1; }
.composer textarea { width: 100%; min-height: 40px; max-height: 120px; resize: none; overflow-y: hidden; -webkit-appearance: none; padding: 9px 10px; border: 1px solid #dce3eb; border-radius: 7px; background: #fbfcfd; color: #35475d; font-size: 13px; line-height: 1.45; }
.composer textarea::placeholder { color: #a4afbc; }
.composer textarea:focus { border-color: #8db1e6; outline: none; box-shadow: 0 0 0 3px rgba(47, 114, 214, .1); }
.composer-actions { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.image-button { width: 52px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #dce3eb; border-radius: 7px; background: #fff; color: #5175a1; font-size: 12px; font-weight: 600; }
.image-button:active { background: #f3f7fc; border-color: #b9cde7; }
.send-button { width: 100%; height: 38px; border-radius: 7px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 650; }
.send-button:disabled { background: #a9bedc; cursor: wait; }
.image-button:disabled { opacity: .55; cursor: wait; }
.composer-note { margin: 6px 2px 0; color: #9aa6b4; font-size: 10px; line-height: 1.45; }

.message-image, .message-video { display: block; width: min(220px, 100%); max-height: 220px; margin-top: 6px; border-radius: 6px; object-fit: cover; background: #eef3f8; }
.message-image { cursor: zoom-in; }
.media-viewer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(11, 20, 34, .8); }
.media-viewer.hidden { display: none; }
.media-viewer-content { max-width: 96vw; max-height: 90vh; display: grid; place-items: center; }
.media-viewer-media { display: block; max-width: 96vw; max-height: 88vh; object-fit: contain; border-radius: 6px; }
.media-viewer-close { position: fixed; top: 14px; right: 16px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font-size: 22px; }

@media (min-width: 641px) {
  body { padding: 16px 0; }
  .customer-app { min-height: calc(100vh - 32px); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(31, 49, 73, .08); }
  .customer-header { position: static; }
}

@media (max-width: 640px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .customer-app {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .conversation {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  /* Prevent mobile WebView auto-zoom when the textarea receives focus. */
  .composer textarea {
    font-size: 16px;
  }
}

.history-button { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #69809e; }
.hidden { display: none !important; }

.return-address-page {
  position: fixed;
  inset: 0;
  z-index: 120;
  width: min(100%, 640px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f5f7fa;
}
.return-address-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: max(9px, env(safe-area-inset-top)) 14px 9px;
  border-bottom: 1px solid #e2e7ed;
  background: #fff;
}
.return-address-head button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  background: transparent;
  color: #3c4b5e;
  font-size: 30px;
  line-height: 1;
}
.return-address-head div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.return-address-head strong { font-size: 16px; }
.return-address-head span { color: #8793a2; font-size: 11px; }
.return-address-loading {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #718094;
  font-size: 13px;
}
.return-address-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px calc(96px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}
.return-address-order {
  padding: 12px;
  border: 1px solid #dfe5ec;
  border-radius: 7px;
  background: #fff;
}
.return-address-order > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 0; }
.return-address-order span { color: #8490a0; font-size: 11px; }
.return-address-order strong { min-width: 0; color: #33455b; font-size: 12px; overflow-wrap: anywhere; }
.return-address-order p { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid #edf0f4; color: #69798d; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.return-address-order-choice { margin-top: 10px; padding: 12px; border: 1px solid #dfe5ec; border-radius: 7px; background: #fff; }
.return-address-order-choice label { display: grid; gap: 6px; color: #55677e; font-size: 12px; }
.return-address-order-choice select { width: 100%; height: 42px; padding: 0 10px; border: 1px solid #d6dde6; border-radius: 6px; background: #fff; color: #33455b; font: inherit; }
.return-address-order-choice button { width: 100%; height: 42px; margin-top: 10px; border-radius: 6px; background: var(--blue); color: #fff; font-weight: 650; }
.return-address-form { margin-top: 10px; }
.return-address-recognizer,
.return-address-fields { padding: 12px; border: 1px solid #dfe5ec; border-radius: 7px; background: #fff; }
.return-address-recognizer label,
.return-address-fields label { display: grid; gap: 6px; color: #55677e; font-size: 12px; }
.return-address-recognizer textarea,
.return-address-fields input,
.return-address-fields textarea {
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid #d6dde6;
  border-radius: 6px;
  background: #fbfcfd;
  color: #26384e;
  font-size: 16px;
  line-height: 1.45;
  resize: vertical;
}
.return-address-recognizer > #recognizeReturnAddress { width: 100%; height: 40px; margin-top: 8px; border: 1px solid #9db9df; border-radius: 6px; background: #edf4ff; color: #315f9e; font-weight: 650; }
.return-address-fields { display: grid; gap: 11px; margin-top: 10px; }
.return-address-region-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.return-address-candidates { display: grid; gap: 7px; margin-top: 9px; }
.return-address-candidate {
  width: 100%;
  height: auto;
  min-height: 72px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  padding: 10px;
  border: 1px solid #cfdbea;
  border-radius: 6px;
  background: #fff;
  color: #50647d;
  text-align: left;
  font-size: 11px;
  line-height: 1.5;
  overflow: visible;
  white-space: normal;
}
.return-address-candidate-head { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; grid-column: 1 / -1; }
.return-address-candidate strong { min-width: 0; color: #334a67; font-size: 12px; }
.return-address-candidate-confidence { flex: 0 0 auto; padding: 1px 5px; border-radius: 4px; background: #edf3fa; color: #60758f; font-size: 10px; }
.return-address-candidate-address { min-width: 0; display: block; grid-column: 1 / -1; color: #425975; overflow-wrap: anywhere; word-break: break-word; }
.return-address-candidate-note { min-width: 0; display: block; color: #7a6848; overflow-wrap: anywhere; }
.return-address-candidate-action { align-self: end; color: #2e65aa; font-weight: 700; white-space: nowrap; }
.return-address-candidate:active { border-color: #7ea5d5; background: #f5f9ff; }
.return-address-rule { margin: 10px 2px 0; color: #8a6843; font-size: 11px; line-height: 1.55; }
.return-address-error { min-height: 20px; margin: 7px 2px; color: #b35240; font-size: 12px; line-height: 1.5; }
.return-address-error[data-tone="success"] { color: #26704b; }
.return-address-error[data-tone="notice"] { color: #78603a; }
.return-address-blocked {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #e5c995;
  border-radius: 8px;
  background: #fff9ed;
  color: #6e542f;
  line-height: 1.65;
}
.return-address-blocked strong { display: block; color: #684719; font-size: 15px; }
.return-address-blocked p { margin: 8px 0 0; font-size: 13px; }
.return-address-blocked button {
  width: 100%; height: 42px; margin-top: 14px; border: 1px solid #b79055;
  border-radius: 6px; background: #fff; color: #785626; font-weight: 700;
}
.return-address-submit {
  position: fixed;
  left: max(12px, calc((100vw - 640px) / 2 + 12px));
  right: max(12px, calc((100vw - 640px) / 2 + 12px));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 121;
  height: 48px;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(30, 66, 112, .2);
}
.return-address-submit:disabled { background: #aebed3; cursor: wait; }

@media (min-width: 641px) {
  .return-address-page { top: 16px; bottom: 16px; border: 1px solid #dfe5ec; }
}
.history-button { font-size: 11px; font-weight: 600; }
.history-close { font-size: 20px; line-height: 1; }
.history-button:active { background: var(--blue-soft); }
.history-panel { position: relative; z-index: 3; max-height: min(46vh, 360px); overflow-y: auto; border-bottom: 1px solid var(--line); background: #fff; box-shadow: 0 5px 16px rgba(31, 49, 73, .08); }
.history-panel-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid #eef1f5; color: #50647f; font-size: 12px; }
.history-close { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: transparent; color: #8a98aa; }
.history-list { padding: 7px 10px 10px; }
.history-empty { padding: 14px 5px; color: #9aa6b4; text-align: center; font-size: 11px; }
.history-item { margin: 0 0 7px; border: 1px solid #e7edf4; border-radius: 7px; background: #fbfcfe; overflow: hidden; }
.history-item:last-child { margin-bottom: 0; }
.history-item summary { position: relative; cursor: pointer; list-style: none; padding: 9px 28px 9px 10px; color: #536985; font-size: 11px; }
.history-item summary::-webkit-details-marker { display: none; }
.history-item summary::after { content: ""; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid #91a0b2; border-bottom: 1.5px solid #91a0b2; transform: translateY(-70%) rotate(45deg); }
.history-item[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.history-item-body { padding: 0 10px 9px; border-top: 1px solid #edf1f5; }
.history-message { padding: 7px 0 0; color: #63748a; font-size: 11px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-message strong { display: block; margin-bottom: 2px; color: #9aa6b4; font-size: 9px; font-weight: 500; }
.history-image, .history-video { display: block; width: min(180px, 100%); max-height: 180px; margin-top: 5px; border-radius: 5px; object-fit: cover; background: #eef3f8; }
.history-image { cursor: zoom-in; }

.work-order-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgba(18, 28, 44, .42); }
.work-order-modal.hidden { display: none !important; }
.work-order-detail-modal { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 18px; background: rgba(18, 28, 44, .42); }
.work-order-detail-modal.hidden { display: none !important; }
.work-order-detail-card { width: min(500px, 100%); max-height: min(92vh, 760px); overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; box-shadow: 0 18px 55px rgba(18, 32, 54, .22); }
.work-order-detail-body { display: grid; gap: 14px; padding: 16px 18px 20px; }
.work-order-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #edf1f5; }
.work-order-detail-label { display: block; margin-bottom: 4px; color: #9aa6b4; font-size: 10px; }
.work-order-detail-top strong { color: #25364d; font-size: 15px; letter-spacing: .02em; }
.work-order-detail-status { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #fff4df; color: #a66a12; font-size: 11px; font-weight: 700; }
.work-order-detail-status.processing { background: #eaf3ff; color: #2968b8; }
.work-order-detail-status.waiting_customer { background: #fff4df; color: #9a6510; }
.work-order-detail-status.unreachable, .work-order-detail-status.agreed_solution, .work-order-detail-status.resolved, .work-order-detail-status.closed { background: #dcf7e7; color: #16834b; }
.work-order-detail-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.work-order-detail-meta div { padding: 9px 10px; border-radius: 8px; background: #f7f9fc; }
.work-order-detail-meta span { display: block; color: #9aa6b4; font-size: 10px; }
.work-order-detail-meta strong { display: block; margin-top: 3px; color: #53657c; font-size: 11px; font-weight: 600; }
.work-order-detail-section { min-width: 0; }
.work-order-detail-section h3 { margin: 0 0 7px; color: #53657c; font-size: 12px; }
.work-order-detail-section p { margin: 0; color: #5f7087; font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.work-order-detail-attachments { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.work-order-detail-attachments img { width: 100%; aspect-ratio: 1; display: block; cursor: zoom-in; border-radius: 7px; object-fit: cover; background: #eef3f8; }
.work-order-detail-empty { grid-column: 1 / -1; color: #a0a8b4; font-size: 11px; }
.work-order-timeline { display: grid; gap: 0; border-left: 2px solid #e5edf8; padding-left: 14px; }
.work-order-timeline-item { position: relative; padding: 0 0 12px; }
.work-order-timeline-item:last-child { padding-bottom: 0; }
.work-order-timeline-item::before { content: ""; position: absolute; left: -20px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: #5e8fdc; box-shadow: 0 0 0 3px #edf4ff; }
.work-order-timeline-item strong { display: block; color: #53657c; font-size: 11px; }
.work-order-timeline-item small { display: block; margin-top: 3px; color: #a0a8b4; font-size: 10px; }
.work-order-timeline-item p { margin-top: 4px; color: #718198; font-size: 11px; }
.work-order-detail-solution-section { padding: 10px 11px; border-radius: 8px; background: #f4f8ff; }
.history-work-order-open { width: 100%; min-height: 32px; margin-top: 8px; border: 1px solid #f2c8d6; border-radius: 6px; background: #fff; color: #c72f61; font-size: 11px; font-weight: 700; }
.history-work-order-open:hover { background: #fff5f8; }
.work-order-modal-card { width: min(460px, 100%); max-height: min(92vh, 700px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; box-shadow: 0 18px 55px rgba(18, 32, 54, .22); }
.work-order-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 18px 13px; border-bottom: 1px solid #edf1f5; }
.work-order-modal-head strong, .work-order-modal-head span { display: block; }
.work-order-modal-head strong { color: #25364d; font-size: 16px; }
.work-order-modal-head span { margin-top: 3px; color: #8a98aa; font-size: 11px; }
.work-order-modal-head button { width: 28px; height: 28px; border-radius: 6px; background: transparent; color: #8996a8; font-size: 22px; line-height: 1; }
.work-order-modal-head button:hover { background: #f1f5fa; color: #425570; }
.work-order-form { min-height: 0; display: grid; align-content: start; grid-auto-rows: max-content; gap: 12px; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px 18px; }
.work-order-section { display: grid; gap: 11px; min-width: 0; margin: 0; padding: 12px; border: 1px solid #e7edf4; border-radius: 10px; background: #fbfcfe; }
.work-order-section legend { padding: 0 5px; color: #3c526d; font-size: 12px; font-weight: 750; }
.work-order-section legend span { color: #9aa6b4; font-size: 10px; font-weight: 500; }
.work-order-form > label { display: grid; gap: 5px; color: #586b84; font-size: 12px; font-weight: 650; }
.work-order-required-mark { margin-left: 4px; color: #d45d69; font-size: 10px; font-style: normal; font-weight: 700; }
.work-order-category-hint { color: #b06b27; font-size: 10px; font-weight: 500; line-height: 1.4; }
.work-order-form input, .work-order-form select, .work-order-form textarea { width: 100%; border: 1px solid #dbe3ec; border-radius: 7px; background: #fbfcfe; color: #33465d; padding: 9px 10px; font-size: 13px; outline: 0; }
.work-order-form input { height: 39px; }
.work-order-form select { height: 39px; }
.work-order-category-control { position: relative; min-width: 0; }
.work-order-category-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important; }
.work-order-category-trigger { width: 100%; height: 39px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px; border: 1px solid #dbe3ec; border-radius: 7px; background: #fbfcfe; color: #33465d; text-align: left; font-size: 13px; cursor: pointer; touch-action: manipulation; }
.work-order-category-trigger:focus-visible, .work-order-category-trigger[aria-expanded="true"] { border-color: #7ca8e8; outline: 0; box-shadow: 0 0 0 3px rgba(47, 114, 214, .1); }
.work-order-category-trigger.is-empty { color: #9aa6b4; }
.work-order-category-chevron { width: 7px; height: 7px; flex: 0 0 auto; border-right: 1.5px solid #8190a4; border-bottom: 1.5px solid #8190a4; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
.work-order-category-trigger[aria-expanded="true"] .work-order-category-chevron { transform: translateY(2px) rotate(225deg); }
.work-order-category-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 12; display: grid; gap: 3px; max-height: 220px; overflow-y: auto; padding: 5px; border: 1px solid #dbe3ec; border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(28, 48, 76, .16); }
.work-order-category-menu.hidden { display: none !important; }
.work-order-category-option { width: 100%; min-height: 36px; padding: 7px 9px; border-radius: 6px; background: #fff; color: #40536b; text-align: left; font-size: 13px; cursor: pointer; touch-action: manipulation; }
.work-order-category-option:hover, .work-order-category-option:focus-visible, .work-order-category-option[aria-selected="true"] { background: #edf4ff; color: #2f72d6; outline: 0; }
.work-order-form textarea { min-height: 86px; resize: vertical; line-height: 1.55; }
.work-order-field-count { display: block; margin-top: -1px; color: #9aa6b4; font-size: 10px; font-weight: 400; text-align: right; }
.work-order-form input:focus, .work-order-form select:focus, .work-order-form textarea:focus { border-color: #7ca8e8; box-shadow: 0 0 0 3px rgba(47, 114, 214, .1); }
.work-order-order-hint { display: block; margin-top: 2px; color: #9aa6b4; font-size: 10px; font-weight: 400; line-height: 1.4; }
.work-order-order-hint.warning { color: #b87535; }
.work-order-upload-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.work-order-upload-row strong, .work-order-upload-row span { display: block; }
.work-order-upload-row strong { color: #586b84; font-size: 12px; }
.work-order-upload-row span { margin-top: 2px; color: #9aa6b4; font-size: 10px; }
.work-order-upload-button { display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border: 1px solid #cbdcf6; border-radius: 6px; background: #f3f7ff; color: #316ed0; font-size: 11px; cursor: pointer; }
.work-order-upload-button:hover { background: #eaf2ff; }
.work-order-image-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; min-height: 0; }
.work-order-image-grid:empty { display: none; }
.work-order-image-item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: #eef3f8; }
.work-order-image-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.work-order-image-item::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 2px solid transparent; border-radius: inherit; }
.work-order-image-item.uploading::after { border-color: #7ca8e8; }
.work-order-image-item.failed::after { border-color: #d47a62; }
.work-order-image-remove { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(20, 30, 45, .72); color: #fff; font-size: 14px; line-height: 1; }
.work-order-image-status { position: absolute; right: 3px; bottom: 3px; left: 3px; padding: 3px 4px; border-radius: 4px; background: rgba(20, 30, 45, .7); color: #fff; font-size: 9px; line-height: 1.1; text-align: center; }
.work-order-image-retry { position: absolute; right: 50%; bottom: 24px; z-index: 1; min-height: 24px; padding: 0 7px; border-radius: 5px; background: #fff; color: #bd604c; font-size: 10px; transform: translateX(50%); }
.work-order-submit-summary { display: grid; gap: 3px; padding: 10px 11px; border-left: 3px solid #7ca8e8; border-radius: 6px; background: #f3f7ff; color: #657892; font-size: 11px; line-height: 1.45; }
.work-order-submit-summary strong { color: #3c5c83; font-size: 11px; }
.work-order-error { min-height: 16px; margin: 0; color: #bd6b49; font-size: 11px; }
.work-order-submit { width: 100%; min-height: 42px; align-self: start; border-radius: 7px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 700; }
.work-order-submit:disabled { background: #aabedc; cursor: wait; }
.work-order-prompt-button { display: inline-flex; align-items: center; justify-content: center; min-width: 148px; min-height: 36px; margin-top: 9px; padding: 0 14px; border: 1px solid #c5d9f5; border-radius: 7px; background: #f1f6ff; color: #2e6fc9; font-size: 12px; font-weight: 700; cursor: pointer; touch-action: manipulation; pointer-events: auto; user-select: none; -webkit-tap-highlight-color: transparent; transition: background .16s ease, border-color .16s ease; }
.work-order-prompt-message { cursor: pointer; }
.work-order-prompt-message .message-bubble { border-color: #c5d9f5; }
.work-order-prompt-button:hover { border-color: #9fbee9; background: #e7f0ff; }
.work-order-prompt-button:active { background: #dceaff; }

@media (max-width: 640px) {
  .work-order-modal { top: var(--work-order-viewport-top, 0px); bottom: auto; align-items: flex-start; width: 100%; height: var(--work-order-viewport-height, 100dvh); min-height: 0; padding: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom)); overflow: hidden; }
  .work-order-modal.keyboard-open { align-items: flex-start; padding-top: 8px; }
  .work-order-modal-card { width: 100%; height: min(90dvh, 700px); max-height: calc(var(--work-order-viewport-height, 100dvh) - 16px); border-radius: 16px; }
  .work-order-modal.keyboard-open .work-order-modal-card { height: calc(var(--work-order-viewport-height, 100dvh) - 16px); max-height: calc(var(--work-order-viewport-height, 100dvh) - 16px); }
  .work-order-modal .work-order-modal-head { position: sticky; top: 0; z-index: 2; padding: 14px 16px 11px; background: #fff; }
  .work-order-modal .work-order-form { flex: 1 1 auto; gap: 11px; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
  .work-order-modal .work-order-form input,
  .work-order-modal .work-order-form select,
  .work-order-modal .work-order-form textarea { min-width: 0; font-size: 16px; line-height: 1.4; }
  .work-order-modal .work-order-form input,
  .work-order-modal .work-order-form select { height: 44px; }
  .work-order-modal .work-order-category-trigger { height: 44px; font-size: 16px; }
  .work-order-modal .work-order-category-option { min-height: 44px; padding: 9px 10px; font-size: 16px; }
  .work-order-modal .work-order-form textarea { min-height: 108px; }
  .work-order-modal .work-order-upload-row { align-items: flex-start; }
  .work-order-modal .work-order-upload-button { flex: 0 0 auto; min-height: 38px; }
  .work-order-modal .work-order-submit { position: static; height: 46px; min-height: 46px; margin-top: 1px; padding: 0 14px; background: var(--blue); }
  .work-order-detail-modal { align-items: end; padding: 0; }
  .work-order-detail-card { width: 100%; max-height: 90dvh; border-radius: 16px 16px 0 0; }
  .work-order-detail-body { padding-left: 16px; padding-right: 16px; }
  .work-order-detail-meta { grid-template-columns: 1fr; }
  .work-order-image-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .work-order-detail-attachments { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Mobile customer page: use a lightweight service-chat layout with large,
   scannable FAQ rows and a stable bottom composer. */
:root {
  --page: #f3f3f5;
  --surface: #ffffff;
  --ink: #17191f;
  --muted: #a0a1a6;
  --line: #e9e9ec;
  --accent: #f03368;
}

body { background: var(--page); }
.customer-app { background: var(--page); }
.customer-app { position: relative; }
.customer-header { display: none; }
.conversation-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--page);
  scrollbar-width: none;
}
.conversation-area::-webkit-scrollbar { display: none; }
.new-message-button {
  position: absolute;
  right: 14px;
  bottom: 82px;
  z-index: 4;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #f0b9c8;
  border-radius: 15px;
  background: #fff5f8;
  color: #b7355d;
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(84, 31, 52, .12);
}
.new-message-button.hidden { display: none; }
.connection-state {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  z-index: 5;
  padding: 4px 9px;
  border-radius: 12px;
  background: rgba(35, 39, 48, .78);
  color: #fff;
  font-size: 10px;
  transform: translateX(-50%);
}
.connection-state.hidden { display: none; }
.conversation-area.chat-started .quick-replies { display: none; }
.customer-header {
  min-height: 58px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  gap: 8px;
  background: rgba(250, 250, 251, .98);
  border-bottom: 1px solid #e6e6e9;
}
.header-back {
  width: 32px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  background: transparent;
  color: #17191f;
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 300;
  line-height: 1;
}
.header-back:active { opacity: .55; }
.brand-mark, .channel-label { display: none; }
.brand-copy { align-self: center; }
.brand-copy h1 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0;
  color: #181a20;
}
.brand-copy p { display: none; }
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-icon {
  width: 26px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  color: #17191f;
  font-size: 25px;
  line-height: 1;
}
.header-icon:active { opacity: .55; }

.quick-replies {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
  padding: 0 12px 8px;
  background: var(--page);
  border: 0;
  scrollbar-width: none;
}
.quick-replies::-webkit-scrollbar { display: none; }
.faq-card {
  width: 100%;
  overflow: hidden;
  border-radius: 0 0 18px 18px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(28, 30, 37, .02);
}
.faq-card + .faq-card { margin-top: 12px; border-radius: 18px; }
.faq-card button {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid #f1f1f3;
  border-radius: 0;
  background: #fff;
  color: #17191f;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
}
.faq-card button:last-child { border-bottom: 0; }
.faq-card button:active { background: #fff5f8; }
.faq-dot { width: 6px; height: 6px; display: block; border-radius: 50%; background: var(--accent); }
.faq-arrow { color: #b7b8bd; font-family: Georgia, serif; font-size: 30px; font-weight: 300; line-height: .7; text-align: right; }
.faq-greeting { margin: 0; padding: 18px 16px 6px 38px; color: #17191f; font-size: 17px; line-height: 1.45; }

.conversation {
  min-height: 260px;
  overflow: visible;
  padding: 12px 12px 10px;
  background: var(--page);
}
.day-note { margin: 0 auto 12px; color: #b3b4b9; font-size: 12px; }
.message { gap: 8px; margin-bottom: 12px; }
.message-avatar { width: 32px; height: 32px; font-size: 10px; }
.message-avatar img { width: 100%; height: 100%; }
.message-body { max-width: min(calc(100% - 40px), 460px); }
.message-bubble {
  padding: 13px 15px;
  border: 0;
  border-radius: 4px 18px 18px 18px;
  background: #fff;
  color: #17191f;
  box-shadow: 0 1px 0 rgba(28, 30, 37, .02);
  font-size: 16px;
  line-height: 1.6;
}
.message.user .message-bubble { border: 0; border-radius: 18px 4px 18px 18px; background: #ffe8ef; color: #461e2c; }
.message.agent .message-bubble { border: 0; background: #fff; color: #17191f; }
.message.system .message-bubble { color: #a4a7ad; background: #fff; font-size: 13px; }
.message-meta { margin-top: 4px; color: #b1b2b7; font-size: 11px; }
.message-meta.escalate { color: #c97a8f; }

.composer {
  flex: 0 0 auto;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  border-top: 0;
  background: var(--page);
}
.image-preview { margin-bottom: 7px; border-radius: 12px; background: #fff; }
.composer-row { display: flex; align-items: center; gap: 5px; width: 100%; }
.composer-input { min-width: 0; flex: 1 1 auto; padding: 0 13px; border-radius: 24px; background: #fff; }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 96px;
  padding: 10px 0;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #17191f;
  font-size: 16px;
  line-height: 1.5;
}
.composer textarea:focus { border: 0; box-shadow: none; }
.composer-icon, .send-button {
  width: 36px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #17191f;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}
.composer-icon:active, .send-button:active { background: #e9e9ec; }
.image-button { border: 0; background: transparent; color: #17191f; font-size: 31px; font-weight: 300; }
.phone-button { font-size: 22px; }
.send-button { width: 42px; background: #17191f; color: #fff; font-size: 25px; }
.send-button:disabled { background: #bfc0c4; color: #fff; }
.composer-note { display: none; }

.emoji-panel {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 76px;
  max-height: min(280px, 38vh);
  overflow-y: auto;
  padding: 14px 13px 16px;
  border-top: 1px solid #e3e3e6;
  background: #f3f3f5;
  box-shadow: 0 -8px 22px rgba(26, 28, 35, .08);
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px 5px; }
.emoji-choice {
  min-width: 0;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}
.emoji-choice:active { background: #e3e3e7; transform: scale(.94); }

@media (max-width: 420px) {
  .faq-card button { min-height: 56px; padding: 9px 14px; font-size: 15px; }
  .faq-greeting { padding-left: 36px; font-size: 16px; }
  .header-actions { gap: 8px; }
  .header-icon { width: 24px; font-size: 23px; }
  .emoji-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px 4px; }
  .emoji-choice { font-size: 26px; }
}

/* Customer header and service records */
.customer-header {
  display: flex;
  min-height: 72px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  gap: 10px;
  background: rgba(250, 250, 251, .98);
  border-bottom: 1px solid #e6e6e9;
}
.brand-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f8dfe8;
  box-shadow: inset 0 0 0 1px rgba(208, 123, 147, .13);
}
.brand-avatar span { font-size: 27px; line-height: 1; }
.brand-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.brand-copy { min-width: 0; align-self: center; }
.brand-copy h1 { color: #181a20; font-size: 20px; font-weight: 750; line-height: 1.25; }
.brand-copy p { display: none; }
.header-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.header-action {
  min-width: 42px;
  min-height: 48px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 1px 0;
  border: 0;
  background: transparent;
  color: #17191f;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.05;
  white-space: nowrap;
}
.header-action:active { opacity: .55; }
.service-record-glyph { font-size: 31px; font-family: Arial, sans-serif; line-height: .78; }
.phone-glyph { font-size: 31px; line-height: .9; transform: rotate(-18deg); }
.history-panel {
  position: absolute;
  inset: 72px 0 auto;
  z-index: 7;
  height: calc(100vh - 72px);
  max-height: none;
  overflow-y: auto;
  border-bottom: 1px solid #e2e3e7;
  background: #fff;
  box-shadow: 0 8px 22px rgba(26, 28, 35, .12);
}
.history-panel-head { min-height: 52px; padding: 0 16px; color: #17191f; font-size: 17px; }
.history-tabs { display: flex; padding: 0 16px; border-bottom: 1px solid #f0f0f2; }
.history-tab { position: relative; min-height: 42px; padding: 0 16px 0 0; margin-right: 26px; border: 0; background: transparent; color: #9a9ba1; font-size: 14px; }
.history-tab b { margin-left: 3px; font-size: 12px; font-weight: 500; }
.history-tab.active { color: #17191f; font-weight: 700; }
.history-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--accent); }
.history-list { padding: 10px 14px 14px; }
.history-item { margin-bottom: 9px; border-color: #ececf0; border-radius: 10px; background: #fcfcfd; }
.history-item summary { padding: 12px 32px 12px 12px; color: #4d4e55; font-size: 13px; }
.history-item-body { padding: 0 12px 11px; }
.history-message { padding-top: 8px; color: #63646c; font-size: 12px; }
.history-message strong { color: #9a9ba1; font-size: 10px; }
.history-work-order { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 2px; padding: 8px 9px; border-radius: 7px; background: #fff5f8; color: #7d4054; font-size: 11px; }
.history-work-order-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-work-order-status { flex: 0 0 auto; color: #c72f61; font-weight: 700; }

/* The host mini-program already shows the page title in its top bar. Keep the
   avatar and action buttons in this header without rendering the title twice. */
.customer-header .brand-copy { display: none; }

@media (max-width: 420px) {
  .customer-header { min-height: 68px; padding-left: 10px; padding-right: 10px; gap: 8px; }
  .brand-avatar { width: 42px; height: 42px; }
  .brand-avatar span { font-size: 24px; }
  .brand-copy h1 { font-size: 19px; }
  .header-actions { gap: 8px; }
  .header-action { min-width: 38px; min-height: 44px; font-size: 9px; }
  .service-record-glyph, .phone-glyph { font-size: 28px; }
  .history-panel { inset: 68px 0 auto; height: calc(100dvh - 68px); }
}
.order-panel{margin:0 14px 10px;border:1px solid #e4e8ef;border-radius:8px;background:#fff;box-shadow:0 4px 18px rgba(36,55,82,.06);overflow:hidden}.order-panel.hidden{display:none}.order-panel-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid #eef1f5}.order-panel-head strong{display:block;color:#24344b;font-size:14px}.order-panel-head span{display:block;margin-top:3px;color:#8c97a6;font-size:11px}.order-panel-head button{border:0;background:transparent;color:#9aa4b2;font-size:20px;line-height:1;cursor:pointer}.order-panel-list{display:flex;flex-direction:column;gap:8px;padding:10px}.order-option{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px;border:1px solid #e8ecf2;border-radius:6px;background:#fff;text-align:left;cursor:pointer}.order-option:hover,.order-option.selected{border-color:#2d8cff;background:#f5f9ff}.order-option-image{width:42px;height:42px;overflow:hidden;border-radius:4px;background:#f1f4f8;display:grid;place-items:center;color:#9aa6b5;font-size:11px}.order-option-image img{width:100%;height:100%;object-fit:cover}.order-option-main{min-width:0}.order-option-number{display:flex;gap:7px;align-items:center;color:#21344e;font-size:13px;font-weight:700}.order-option-number span{color:#2d8cff;font-size:10px;font-weight:600}.order-option-title{margin-top:4px;overflow:hidden;color:#4e5d71;font-size:12px;white-space:nowrap;text-overflow:ellipsis}.order-option-meta{margin-top:4px;color:#8d98a7;font-size:11px}.order-option-arrow{color:#2d8cff;font-size:18px}.order-detail{margin:0 10px 10px;padding:10px 12px;border-top:1px solid #edf1f5;color:#526174;font-size:11px;line-height:1.65}.order-detail strong{color:#24344b;font-size:12px}.order-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px 14px;margin-top:6px}.order-detail-grid span{color:#8b96a5}.order-detail-grid b{color:#405169;font-weight:600}.order-detail-items{margin-top:7px;padding-top:7px;border-top:1px dashed #e4e8ee}.order-detail-item{display:flex;justify-content:space-between;gap:8px}.order-detail-item span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.order-detail-item span:last-child{white-space:nowrap;color:#697991}@media(max-width:640px){.order-panel{margin:0 10px 8px}.order-option{grid-template-columns:38px minmax(0,1fr) auto}.order-option-image{width:38px;height:38px}.order-option-number{font-size:12px}}

.message.recalled { width: 100%; justify-content: center; margin: 4px auto 14px; }
.message.recalled .message-avatar { display: none; }
.message.recalled .message-body { max-width: 88%; }
.message.recalled .message-bubble { padding: 4px 10px; border: 0; border-radius: 0; background: transparent; color: #a4a7ad; text-align: center; font-size: 12px; line-height: 1.5; box-shadow: none; font-style: normal; }
.message.recalled .message-meta { display: none; }
