:root {
  color-scheme: dark;
  --ink: #f3f7fb;
  --text: #e5edf4;
  --message-original: #eee9df;
  --message-translated: #9fc5e8;
  --muted: #aebdcc;
  --line: #394d5c;
  --soft: #101923;
  --green: #72e1b5;
  --pale: #173f61;
  --white: #22313f;
  --danger: #ffb0b5;
  --blue: #8bcbff;
  --selection: #173f61;
  --selection-edge: #69baff;
  --warning: #ffda8a;
  --warning-bg: #45351b;
  --purple: #d0b8ff;
  --purple-bg: #352d4e;
  --font-ui:
    "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI",
    "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-family: var(--font-ui);
  color: var(--text);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #101820;
  font-size: 14px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.5;
}
input,
textarea,
select {
  border: 1px solid #394d5c;
  background: #18232e;
  border-radius: 9px;
  color: var(--text);
  padding: 12px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--selection-edge);
  box-shadow: 0 0 0 3px #69baff30;
}
input[type="checkbox"] {
  accent-color: var(--green);
  width: 17px;
  height: 17px;
  padding: 0;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--selection-edge);
  outline-offset: 3px;
}
svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
  line-height: 1.7;
}
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #b8c8d6;
}
.brand-icon {
  height: 42px;
  width: 42px;
  border-radius: 13px;
  background: #214b46;
  color: #b8c8d6;
  display: inline-grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -4px;
  padding-right: 4px;
}
.primary {
  background: var(--green);
  color: #fff;
  padding: 12px 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 44px;
  font-weight: 750;
  transition: background 0.2s;
}
.primary:hover {
  background: #95efcd;
}
.primary span {
  font-size: 18px;
  font-weight: 400;
}
.secondary {
  background: #22313f;
  border: 1px solid #394d5c;
  padding: 10px 14px;
  border-radius: 8px;
  min-height: 42px;
  font-size: 12px;
  font-weight: 600;
}
.secondary:hover {
  background: #17221d;
}
.danger {
  color: var(--danger);
  background: #22313f;
}
.full {
  width: 100%;
}
.text-button {
  color: var(--green);
  font-size: 12px;
  padding: 10px 2px;
  font-weight: 600;
}
.error {
  color: var(--danger);
  line-height: 1.6;
}
.icon-button {
  height: 40px;
  min-width: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  font-size: 24px;
}
.icon-button:hover {
  background: var(--soft);
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
form {
  display: grid;
  gap: 18px;
}
.login-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.04fr 1fr;
}
.login-intro {
  padding: 54px 12%;
  background: #164639;
  color: #f2f8ef;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-intro:after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border: 1px solid #c3ddc419;
  border-radius: 50%;
  bottom: -190px;
  right: -190px;
  box-shadow:
    0 0 0 70px #c3ddc407,
    0 0 0 140px #c3ddc404;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 20px;
  font-weight: 600;
}
.login-intro .eyebrow {
  color: #adc8b7;
}
.login-intro h1 {
  font-size: clamp(30px, 3.7vw, 56px);
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 22px 0;
}
.login-intro p {
  color: #b0c9bb;
  line-height: 2.2;
  font-size: 14px;
}
.login-intro small {
  color: #8cac9a;
  font-size: 11px;
  letter-spacing: 3px;
}
.login-card {
  width: 360px;
  max-width: calc(100% - 50px);
  align-self: center;
  justify-self: center;
}
.login-card h2 {
  font-size: 28px;
  font-weight: 650;
  margin: 12px 0;
}
.login-card form {
  margin-top: 30px;
}
.login-card input {
  height: 48px;
}
.login-card .saved-login-options .check-row {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  width: fit-content;
  cursor: pointer;
}
.login-card .saved-login-options input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
}
.saved-login-options .helper {
  margin: 4px 0 0;
}
.login-note {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin-top: 30px;
}
.mobile-brand {
  display: none;
}
.workspace {
  height: 100dvh;
  display: grid;
  grid-template-columns: 76px 344px minmax(0, 1fr);
  overflow: hidden;
}
.rail {
  background: #112b32;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 14px;
  padding: 25px 0 20px;
}
.rail > .brand-icon {
  margin-bottom: 22px;
}
.rail-button {
  height: 44px;
  width: 44px;
  color: #b3cbd3;
  display: grid;
  place-items: center;
  border-radius: 12px;
}
.rail-button.active,
.rail-button:hover {
  color: #c5ffea;
  background: #245249;
}
.rail-spacer {
  flex: 1;
}
.user-avatar {
  position: relative;
  overflow: hidden;
  height: 34px;
  width: 34px;
  background: #3b3157;
  color: var(--purple);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}
.user-avatar .avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wa-profile-preview {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  margin: 12px 0;
}
.wa-profile-preview[hidden],
#mobile-profile {
  display: none;
}
@media (max-width: 721px) {
  #mobile-profile {
    display: inline-flex;
  }
}
.inbox {
  background: #18232e;
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inbox-header {
  padding: 30px 24px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.inbox-header h1 {
  font-size: 25px;
  margin: 8px 0 0;
  font-weight: 650;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.new-chat {
  background: var(--soft);
  font-size: 24px;
  color: var(--green);
}
#mobile-settings {
  display: none;
}
.account-filter {
  padding: 4px 23px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.account-filter select {
  border: 0;
  background: none;
  padding: 4px 0;
  width: 160px;
  font-size: 12px;
  font-weight: 600;
}
.pill {
  border-radius: 30px;
  background: #101820;
  color: #b8c8d6;
  padding: 5px 9px;
  font-size: 10px;
  white-space: nowrap;
}
.search {
  margin: 0 22px;
  flex-direction: row;
  align-items: center;
  background: var(--soft);
  border-radius: 9px;
  padding: 0 11px;
  gap: 8px;
}
.search svg {
  width: 17px;
  color: #9aa8a1;
  flex-shrink: 0;
}
.search input {
  padding: 12px 0;
  background: none;
  border: 0;
  box-shadow: none;
  min-width: 0;
  font-size: 12px;
  width: 100%;
}
.filter-tabs {
  display: flex;
  gap: 22px;
  padding: 21px 24px 0;
  border-bottom: 1px solid var(--line);
}
.filter-tabs button {
  padding: 0 0 14px;
  font-size: 13px;
  color: #aebdcc;
  border-bottom: 2px solid transparent;
  display: flex;
  gap: 6px;
  align-items: center;
}
.filter-tabs button.selected {
  color: var(--blue);
  border-color: var(--selection-edge);
  font-weight: 750;
}
.filter-tabs span {
  background: #22313f;
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 11px;
}
.conversation-list {
  overflow: auto;
  flex: 1;
  padding: 8px 10px;
}
.conversation-item {
  display: flex;
  gap: 12px;
  padding: 16px 12px;
  text-align: left;
  width: 100%;
  border-radius: 10px;
  margin: 3px 0;
  align-items: center;
  border: 1px solid transparent;
  position: relative;
}
.conversation-item:hover {
  background: #263a4b;
}
.conversation-item.selected {
  background: var(--selection);
  border-color: #4a83ad;
  box-shadow: inset 4px 0 0 var(--selection-edge);
}
.contact-avatar {
  height: 42px;
  width: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #24475b;
  color: #b9e3ff;
  font-weight: 650;
  font-size: 15px;
}
.contact-avatar.tint1 {
  background: #453963;
  color: #e0ccff;
}
.contact-avatar.tint2 {
  background: #4d4027;
  color: #ffe0a2;
}
.contact-avatar.tint3 {
  background: #244a40;
  color: #a4f3d3;
}
.conversation-info {
  min-width: 0;
  flex: 1;
}
.conversation-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.conversation-line strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 650;
  color: var(--ink);
}
.conversation-line time {
  font-size: 11px;
  color: #aebdcc;
  flex-shrink: 0;
}
.conversation-preview {
  font-size: 13px;
  color: #b8c8d6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 8px;
}
.conversation-account {
  font-size: 11px;
  color: #aebdcc;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}
.badge {
  font-size: 11px;
  min-width: 21px;
  height: 21px;
  border-radius: 10px;
  background: var(--green);
  color: #09271d;
  display: grid;
  place-items: center;
  margin-top: 7px;
  font-weight: 800;
  padding: 0 5px;
}
.list-empty {
  padding: 55px 24px;
  text-align: center;
  color: #aebdcc;
  font-size: 12px;
  line-height: 2;
}
.list-empty strong {
  display: block;
  color: #b8c8d6;
  font-weight: 500;
  margin-bottom: 10px;
  font-size: 14px;
}
.inbox-footer {
  border-top: 1px solid var(--line);
  padding: 15px 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}
.connection {
  font-size: 11px;
  color: #aebdcc;
  display: flex;
  align-items: center;
  gap: 6px;
}
.connection i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.connection.offline i {
  background: var(--warning);
}
.version {
  font-size: 10px;
  color: #bac4bd;
}
.chat-area {
  min-width: 0;
  background: #101820;
  position: relative;
  overflow: hidden;
}
.empty-chat {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 30px;
  position: relative;
}
.empty-symbol {
  width: 102px;
  height: 102px;
  border-radius: 32px;
  background: #22313f;
  display: grid;
  place-items: center;
  color: #b8c8d6;
  position: relative;
  margin-bottom: 34px;
  transform: rotate(-7deg);
}
.empty-symbol svg {
  height: 64px;
  width: 64px;
  stroke-width: 1.7;
  transform: rotate(7deg);
}
.tiny-dot {
  width: 16px;
  height: 16px;
  border: 4px solid #394d5c;
  background: #162119;
  border-radius: 50%;
  position: absolute;
  right: -3px;
  top: 9px;
}
.empty-chat .eyebrow {
  letter-spacing: 1.5px;
  font-size: 10px;
  color: #8ca18d;
}
.empty-chat h2 {
  font-size: 26px;
  font-weight: 550;
  letter-spacing: 1px;
  margin: 18px 0 8px;
}
.empty-chat p {
  font-size: 13px;
  color: #aebdcc;
  line-height: 1.9;
  margin-bottom: 27px;
}
.empty-chat > .primary {
  font-size: 12px;
  padding: 12px 18px;
  background: #346b4e;
}
.empty-features {
  display: flex;
  gap: 25px;
  margin-top: 58px;
  font-size: 11px;
  color: #aebdcc;
}
.empty-chat small {
  position: absolute;
  bottom: 30px;
  font-size: 10px;
  letter-spacing: 1px;
  color: #a2afa2;
}
.active-chat {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.chat-header {
  height: 84px;
  min-height: 84px;
  padding: 0 28px;
  background: #18232e;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 13px;
}
.chat-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  text-align: left;
  padding: 3px;
  border-radius: 10px;
}
.chat-contact:hover {
  background: #ffffff08;
}
.chat-heading {
  min-width: 0;
  flex: 1;
}
.chat-heading .chat-name {
  display: block;
  font-size: 17px;
  margin: 0 0 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 750;
  color: var(--ink);
}
.chat-heading .chat-subtitle {
  display: block;
  font-size: 12px;
  color: #b8c8d6;
  margin: 0;
}
#back-button {
  display: none;
}
.conversation-notice {
  background: var(--warning-bg);
  padding: 10px 25px;
  color: var(--warning);
  font-size: 12px;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 30px;
  scroll-behavior: auto;
  background-image: radial-gradient(#66869c12 1px, transparent 1px);
  background-size: 16px 16px;
}

/* Keyboard changes the visual viewport on iOS without resizing 100dvh. */
@media (max-width: 720px) {
  body:has(#workspace:not(.hidden)) {
    overflow: hidden;
    overscroll-behavior: none;
  }
  #workspace {
    position: fixed;
    top: var(--viewport-top, 0px);
    left: 0;
    width: 100%;
    height: var(--viewport-height, 100dvh);
  }
  #workspace .chat-area {
    position: absolute;
    inset: 0;
    z-index: 2;
  }
  #workspace.chat-open .inbox {
    display: flex;
    visibility: hidden;
  }
  #workspace.swipe-back .inbox {
    visibility: visible;
  }
  #workspace.swipe-back .chat-area {
    will-change: transform;
    box-shadow: -8px 0 24px #0005;
  }
  #workspace.swipe-settle .chat-area {
    transition: transform 180ms ease-out;
  }
  #workspace .messages {
    overscroll-behavior-y: contain;
  }
  #workspace .composer {
    flex-shrink: 0;
  }
  #workspace.keyboard-open .composer {
    padding-bottom: 0;
  }
  #workspace.keyboard-open .composer textarea {
    min-height: 42px;
    max-height: 76px;
  }
  #workspace.keyboard-open .composer-bottom {
    padding-top: 0;
    padding-bottom: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #workspace.swipe-settle .chat-area {
    transition: none;
  }
}
.date-separator {
  text-align: center;
  color: #b8c8d6;
  font-size: 11px;
  margin: 13px 0 20px;
  font-weight: 600;
}
.message-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 17px;
}
.message-row.out {
  align-items: flex-end;
}
.message-row:focus {
  outline: none;
}
.message-row:focus-visible > .bubble,
.message-row.message-jump > .bubble {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.bubble {
  max-width: min(78%, 620px);
  border: 1px solid #394d5c;
  border-radius: 4px 13px 13px 13px;
  background: #263645;
  padding: 13px 15px;
  box-shadow: 0 2px 5px #0002;
  position: relative;
  overflow-wrap: anywhere;
  border-color: #455f73;
}
.out .bubble {
  border-color: #367c6c;
  background: #174c42;
  border-radius: 13px 4px 13px 13px;
}
.message-text {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 14px;
  color: var(--message-original);
}
.message-translation {
  border-top: 1px solid #bbd6e436;
  padding-top: 10px;
  margin-top: 9px;
  color: var(--message-translated);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.message-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  color: #bdd0d6;
  justify-content: flex-end;
  margin-top: 9px;
  flex-wrap: wrap;
}
.message-meta .text-button {
  font-size: 11px;
  padding: 3px;
}
.message-error {
  font-size: 12px;
  color: var(--danger);
  max-width: 80%;
  line-height: 1.6;
  margin-top: 6px;
  background: #40242d;
  padding: 7px 10px;
  border-radius: 7px;
}
.message-actions {
  display: flex;
  gap: 10px;
}
.message-actions button {
  font-size: 12px;
  text-decoration: underline;
  color: var(--blue);
  padding: 7px 0;
  font-weight: 650;
}
.media-image {
  max-width: 100%;
  max-height: 320px;
  border-radius: 6px;
  display: block;
}
.media-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
}
.video-preview {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  min-width: 150px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #101417;
  color: #fff;
}
.video-preview .media-video {
  display: block;
  pointer-events: none;
}
.single-photo-image:not([data-preview-sized]),
.video-poster:not([data-preview-sized]) {
  width: 225px;
  height: auto;
  /* Keep the placeholder stable until data-preview-sized releases the real dimensions. */
  aspect-ratio: 3 / 4;
  object-fit: contain;
}
.single-photo-image:not([data-preview-sized]) {
  width: 240px;
}
.video-preview-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0008;
  font-size: 24px;
  padding-left: 3px;
}
.video-preview-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 8px 6px;
  background: linear-gradient(transparent, #0009);
  text-align: left;
  font-size: 11px;
}
.media-audio {
  max-width: 100%;
  width: 270px;
}
.file-link {
  color: var(--green);
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  text-decoration: none;
  font-size: 12px;
}
.composer {
  margin: 0 22px 21px;
  border: 1px solid #394d5c;
  border-radius: 12px;
  background: #18232e;
  box-shadow: 0 4px 16px #0002;
  border-color: #526b7e;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px 0;
}
.tool {
  font-size: 20px;
  color: #b8c8d6;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0;
  font-weight: 600;
}
.tool span {
  font-size: 12px;
}
.ai-tool {
  color: var(--purple);
  background: var(--purple-bg);
  padding: 3px 9px;
  border-radius: 7px;
}
.toolbar-spacer {
  flex: 1;
}
.mode-label {
  flex-direction: row;
  align-items: center;
  font-size: 11px;
  color: #b8c8d6;
  gap: 5px;
  white-space: nowrap;
}
.composer textarea {
  resize: none;
  border: 0;
  box-shadow: none;
  width: 100%;
  padding: 12px 16px;
  line-height: 1.7;
  min-height: 72px;
  max-height: 160px;
  font-size: 14px;
  background: transparent;
}
.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px 12px;
}
.composer-bottom > span {
  font-size: 11px;
  color: var(--muted);
}
.send {
  min-height: 35px;
  padding: 8px 16px;
  font-size: 12px;
  gap: 13px;
}
.attachment-bar {
  padding: 14px 18px;
  margin: 0 25px 10px;
  flex-shrink: 0;
  border: 1px solid #4a718a;
  border-radius: 12px;
  background: #1a3546;
  color: var(--text);
}
.attachment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.attachment-heading strong {
  font-size: 14px;
}
.attachment-heading button {
  padding: 6px 10px;
  min-height: 34px;
  font-size: 12px;
}
.attachment-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 8px;
}
.attachment-card {
  position: relative;
  flex: 0 0 132px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #43637a;
  border-radius: 9px;
  background: #152733;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.attachment-preview {
  height: 82px;
  border-radius: 5px;
  overflow: hidden;
  background: #0d1d15;
  display: grid;
  place-items: center;
}
.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attachment-preview > span:not(.attachment-number) {
  color: var(--green);
  font-weight: 600;
}
.attachment-number {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #10261de6;
  font-size: 11px;
}
.attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #10261d;
  border: 1px solid #557f6b;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text);
}
.attachment-name {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
}
.attachment-size {
  font-size: 10px;
  color: var(--muted);
}
.attachment-status {
  font-size: 11px;
  color: var(--green);
  overflow-wrap: anywhere;
}
.attachment-card progress {
  width: 100%;
  height: 6px;
  accent-color: var(--green);
}
.attachment-card.upload-error {
  border-color: var(--danger);
}
.upload-error .attachment-status {
  color: var(--danger);
}
.attachment-help {
  font-size: 11px;
  color: #bacdc2;
  margin: 6px 0 0;
}
#attach-button {
  background: #204d43;
  color: #a4f3d3;
  border-radius: 7px;
  padding: 3px 9px;
}
#attach-button span {
  font-size: 12px;
  display: inline;
}
@media (max-width: 720px) {
  .attachment-bar {
    margin: 0 8px 8px;
    max-height: 31dvh;
    overflow-y: auto;
  }
  .attachment-preview {
    height: 65px;
  }
  .attachment-card {
    flex-basis: 115px;
  }
  .composer-toolbar {
    flex-wrap: wrap;
  }
}
dialog {
  border: 1px solid #394d5c;
  border-radius: 16px;
  padding: 0;
  width: 720px;
  max-width: calc(100% - 30px);
  max-height: 85dvh;
  background: #18232e;
  color: var(--text);
  box-shadow: 0 20px 100px #14372828;
}
dialog::backdrop {
  background: #173a2d66;
  backdrop-filter: blur(3px);
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #223446;
  z-index: 1;
}
.dialog-header h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 750;
  color: var(--ink);
}
#dialog-body {
  padding: 24px;
  overflow: auto;
}
.dialog-tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding-bottom: 16px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--line);
}
.dialog-tabs button {
  white-space: nowrap;
  padding: 9px 13px;
  border-radius: 7px;
  color: #b8c8d6;
  font-size: 13px;
  min-height: 40px;
  font-weight: 600;
  border: 1px solid transparent;
}
.dialog-tabs .selected {
  background: var(--selection);
  color: var(--blue);
  border-color: #4a83ad;
  font-weight: 750;
  box-shadow: inset 0 -3px var(--selection-edge);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .span-2 {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 5px 0 14px;
  color: var(--ink);
}
.setting-card {
  border: 1px solid var(--line);
  padding: 17px;
  border-radius: 11px;
  margin-bottom: 12px;
  background: #1e2d3b;
}
.setting-card h3 {
  font-size: 14px;
  margin: 0 0 7px;
  font-weight: 700;
  color: var(--ink);
}
.setting-card p {
  font-size: 12px;
  margin: 4px 0;
  color: var(--muted);
  line-height: 1.8;
}
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  align-items: start;
  gap: 12px;
  margin-top: 16px;
}
[data-account-management] > .section-title {
  margin: 0 0 8px;
}
[data-account-management] > .section-title button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.75rem;
}
.account-list-hint {
  margin: 0;
}
.account-grid > .setting-card {
  min-width: 0;
  margin: 0;
}
.account-card {
  padding: 15px;
}
.account-card [hidden] {
  display: none !important;
}
.account-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.account-heading h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 8px;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.account-heading h3 small {
  display: inline;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
}
.account-heading .account-status {
  padding: 4px 8px;
  font-size: 0.6875rem;
}
.account-card .account-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 10px;
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.account-summary > span + span {
  color: #8fa6b8;
}
.account-card .account-notice {
  margin-top: 9px;
  font-size: 0.75rem;
  line-height: 1.55;
}
.account-actions {
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-top: 12px;
}
.account-actions > button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  line-height: 1.4;
  border-radius: 7px;
}
.account-actions > .account-refresh {
  min-width: 34px;
  padding: 6px;
}
.account-refresh svg {
  display: block;
  width: 20px;
  height: 20px;
}
.account-more-toggle[aria-expanded="true"] {
  border-color: #5b778c;
  background: #293f50;
}
.account-more,
.account-connection-details {
  min-width: 0;
}
.account-menu-actions {
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.account-menu-standard,
.account-menu-danger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
}
.account-menu-actions button {
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.account-menu-danger {
  margin-top: 3px;
}
.account-menu-danger .danger {
  background: transparent;
  color: #dca5aa;
}
.account-connection-details {
  margin-top: 10px;
}
.account-connection-details[open] {
  padding-top: 9px;
  border-top: 1px solid #344958;
}
.account-connection-details > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  cursor: pointer;
  list-style: none;
  border-radius: 4px;
  color: #9db2c2;
  font-size: 0.75rem;
  line-height: 1.5;
}
.account-connection-details > summary::-webkit-details-marker {
  display: none;
}
.account-connection-details[open] > summary span {
  transform: rotate(180deg);
}
.account-diagnostics {
  margin-top: 9px;
  overflow-wrap: anywhere;
}
.account-card .account-diagnostics p {
  font-size: 0.75rem;
  line-height: 1.65;
}
.account-diagnostics [data-connection-history] {
  margin-top: 8px;
  font-size: 0.75rem;
}
.account-grid + #removed-accounts {
  margin-top: 16px;
}
.status-pill {
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 20px;
  background: #254b3e;
  color: #a4f3d3;
  font-weight: 700;
}
.status-pill.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.account-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 11px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.account-status.connection-failed {
  color: #ffb4b8;
  background: #642832;
  border-color: #ef6670;
}
.account-status.connection-failed::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffb4b8;
  color: #642832;
  font-size: 12px;
}
.account-status.connection-online {
  color: #82e3b4;
  background: #153d2c;
  border-color: #397b58;
}
.account-status.connection-pending {
  color: #ffda8a;
  background: #45351b;
  border-color: #a37a32;
}
.account-status.connection-stopped {
  color: #bbc5bf;
  background: #29342e;
  border-color: #56635b;
}
.qr-image {
  display: block;
  margin: 20px auto;
  max-width: 260px;
  width: 100%;
  image-rendering: pixelated;
}
.helper {
  font-size: 12px;
  color: #aebdcc;
  line-height: 1.8;
  margin: 0;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.empty-inline {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.coach-intent {
  background: var(--purple-bg);
  border-radius: 10px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 18px;
  border: 1px solid #655184;
}
.coach-label {
  font-size: 11px;
  color: #d0b8ff;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 700;
}
.coach-reply {
  font-size: 15px;
  line-height: 1.9;
  margin: 0 0 20px;
  white-space: pre-wrap;
}
.coach-translation {
  font-size: 12px;
  color: #c5bbdc;
  line-height: 1.9;
  background: #282438;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
}
.coach-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.loading {
  padding: 40px;
  text-align: center;
  color: #b8c8d6;
  line-height: 2;
}
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid #394d5c;
  border-top-color: #608a64;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.reply-library {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 310px;
  gap: 14px;
}
.reply-library-head, .reply-library-head > div, .reply-detail-meta,
.reply-preview-heading, .reply-picker-preview footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.reply-library-head > div { align-items: baseline; justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
.reply-library-head h3, .reply-library-detail h4, .reply-copy-block h5, .reply-preview-scroll h3 { margin: 0; }
.reply-library-head h3 { color: var(--ink); font-size: 21px; letter-spacing: -.02em; }
.reply-library-head span, .reply-detail-meta small, .reply-library-guide, .reply-preview-heading small {
  font-size: 12px;
  color: var(--muted);
}
.reply-library-head .primary, .reply-picker-preview .primary {
  color: #09271d;
  background: var(--green);
  font-weight: 700;
  white-space: nowrap;
}
.reply-library-filters, .reply-picker-filters { display: grid; gap: 8px; }
.reply-library-filters { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.reply-library-filters > *, .reply-picker-filters > *, .reply-preview-controls select {
  min-width: 0;
  max-width: 100%;
  padding: 9px 12px;
  min-height: 39px;
}
.reply-library-filters select { max-width: 190px; }
.reply-library-panes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(190px, 35%) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.reply-library-list, .reply-library-detail, .reply-preview-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}
.reply-library-list { position: relative; background: var(--soft); border-right: 1px solid var(--line); }
.reply-flow-heading { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 11px 15px; background: var(--white); border-bottom: 1px solid var(--line); color: var(--green); font-size: 13px; line-height: 1.5; }
.reply-flow-heading small { flex: none; color: var(--muted); font-size: 11px; font-weight: 400; }
.reply-flow-group { min-width: 0; }
.reply-library-list, #quick-reply-options { scroll-padding-top: 48px; }
.reply-library-list button {
  display: grid;
  width: 100%;
  gap: 5px;
  padding: 13px 15px;
  text-align: left;
  line-height: 1.45;
  border-bottom: 1px solid var(--line);
}
.reply-library-list button:hover { background: var(--white); }
.reply-library-list [aria-current="true"] { background: var(--selection); box-shadow: inset 3px 0 var(--selection-edge); }
.reply-library-list button:focus-visible { outline-offset: -3px; }
.reply-library-list small { color: var(--muted); font-size: 11px; }
.reply-library-list strong { font-size: 14px; font-weight: 600; }
.reply-library-detail { padding: clamp(14px, 2vw, 24px); background: #1b2934; }
.reply-library-detail h4 { color: var(--ink); font-size: 19px; line-height: 1.5; }
.reply-detail-meta { margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.reply-detail-meta > span { font-size: 12px; font-weight: 700; color: var(--green); }
.reply-library-back { display: none; }
.reply-review { margin: 8px 0 14px; color: var(--warning); font-size: 12px; line-height: 1.6; }
.reply-copy-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.reply-copy-block h5, .reply-staff-note strong { font-size: 12px; color: var(--muted); }
.reply-copy-block p, .reply-staff-note p { line-height: 1.65; margin: 7px 0 0; white-space: pre-wrap; }
.reply-detail-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.reply-detail-actions .text-button { color: var(--danger); }
.reply-staff-note { border-left: 2px solid var(--line); padding: 2px 0 2px 10px; margin: 15px 0 0; font-size: 13px; line-height: 1.6; }
.reply-library-guide { flex: none; max-height: 30%; overflow-y: auto; line-height: 1.65; }
.reply-library-guide summary { cursor: pointer; font-weight: 650; padding: 3px 0; }
.reply-library-guide p { margin: 5px 0; }
.library-guidance-mount {
  flex: none;
  min-height: 0;
}
.library-ai-guidance {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  max-height: min(46vh, 380px);
  overflow-y: auto;
}
.library-ai-guidance summary {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  min-height: 24px;
}
.library-ai-guidance form {
  margin-top: 14px;
}
.library-ai-guidance textarea {
  min-height: 120px;
  resize: vertical;
}
.library-ai-guidance .guidance-options {
  gap: 12px;
}
.library-guidance-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.library-guidance-footer [role="status"] {
  color: var(--muted);
  font-size: 12px;
}
.reply-purpose,
.reply-example {
  margin-top: 12px;
}
.reply-purpose strong,
.reply-example strong {
  color: var(--muted);
  font-size: 12px;
}
.library-branch-fields {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.library-branch-fields + .library-branch-fields {
  margin-top: 14px;
}
.library-branch-fields legend {
  color: var(--green);
  font-size: 13px;
  padding: 0 5px;
}
.library-branch-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}
.library-branch-heading label {
  flex: 1 1 160px;
}
.library-branch-heading .text-button {
  font-size: 12px;
  min-height: 38px;
}
.library-branch-fields textarea {
  font-size: 14px;
}
.library-more summary,
.library-branch-matching summary {
  cursor: pointer;
  color: var(--muted);
  padding: 10px 0;
}
.library-more[open] summary,
.library-branch-matching[open] summary {
  margin-bottom: 10px;
}
.library-control-help { margin: 0; }
#dialog.quick-manage-dialog { overflow: hidden; }
#dialog.quick-manage-dialog[open] { display: flex; flex-direction: column; }
#dialog.quick-manage-dialog .dialog-header { flex: none; }
#dialog.quick-manage-dialog #dialog-body { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; }
#quick-form > button[type="submit"] { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 -10px 18px #182632; }
.library-control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.library-reference-controls > summary, .library-acceptance > summary, .library-account-scope > summary { cursor: pointer; padding: 10px 0; }
.library-reference-controls > :not(summary), .library-acceptance > :not(summary) { margin-top: 10px; }
.library-fact-options, .library-test-fields { min-width: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.library-fact-options legend, .library-test-fields legend { color: var(--muted); font-size: 13px; padding: 0 5px; }
.library-fact-options .check-row { margin: 6px 0; }
.library-test-fields label { margin-bottom: 10px; }
@media (max-width: 420px) { .library-control-grid { grid-template-columns: minmax(0, 1fr); } }
.library-branch-matching { margin-top: 6px; }
.library-branch-matching summary { font-size: 12px; }
@media (max-width: 720px) {
  .reply-library { gap: 10px; }
  .reply-library-head h3 { font-size: 18px; }
  .reply-library-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reply-library-filters input { grid-column: 1 / -1; }
  .reply-library-filters [aria-label="筛选销售阶段"] { grid-column: 1 / -1; }
  .reply-library-filters select { max-width: 100%; }
  .reply-library-panes { grid-template-columns: minmax(0, 1fr); }
  .reply-library-list { border: none; }
  .reply-library[data-detail-open="false"] .reply-library-detail,
  .reply-library[data-detail-open="true"] :is(.reply-library-list, .reply-library-filters, .reply-library-guide) { display: none; }
  .reply-library-back { display: inline-flex; align-items: center; min-height: 40px; padding: 0; margin-bottom: 10px; }
  .reply-library-guide summary { min-height: 36px; }
}
.money {
  font-size: 21px;
  font-weight: 650;
  color: var(--green);
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.7;
}
th {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  background: #253a4b;
}
.check-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 10px 0;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 35px;
  transform: translateX(-50%);
  max-width: 90%;
  background: #25455e;
  color: #fff;
  padding: 13px 20px;
  border-radius: 10px;
  z-index: 100;
  font-size: 12px;
  box-shadow: 0 8px 30px #0002;
  line-height: 1.7;
}
.update-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #173f61;
  border: 1px solid #394d5c;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 12px;
}
.settings-section > p {
  font-size: 12px;
  line-height: 1.8;
}
#dialog.settings-dialog {
  width: min(1040px, calc(100% - 30px));
  height: 85dvh;
  overflow: hidden;
}
#dialog.settings-dialog[open] {
  display: flex;
  flex-direction: column;
}
#dialog.settings-dialog .dialog-header {
  flex-shrink: 0;
}
#dialog.settings-dialog #dialog-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.settings-dialog .dialog-tabs {
  flex-shrink: 0;
  margin: 0;
  padding: 16px 24px 12px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.settings-dialog .dialog-tabs::-webkit-scrollbar {
  display: none;
}
#dialog.settings-dialog .dialog-tabs {
  flex-wrap: wrap;
  overflow: visible;
  gap: 4px;
  padding: 12px 24px;
}
#dialog.settings-dialog .dialog-tabs button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.75rem;
}
.settings-dialog .dialog-tabs button {
  flex-shrink: 0;
  font-weight: 750;
}
.settings-content {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.settings-section {
  height: 100%;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.settings-loading:not([hidden]) {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}
.mobile-only {
  display: none;
}
@media (min-width: 1500px) {
  .workspace {
    grid-template-columns: 80px 380px minmax(0, 1fr);
  }
  .inbox-header {
    padding-top: 36px;
  }
  .chat-header {
    height: 90px;
    min-height: 90px;
  }
  .messages {
    padding: 25px 7%;
  }
  .composer {
    margin: 0 6% 25px;
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 65px 300px minmax(0, 1fr);
  }
  .tool span {
    display: none;
  }
  .composer-toolbar {
    gap: 15px;
  }
  .chat-header {
    padding: 0 18px;
  }
  .messages {
    padding: 18px;
  }
  .chat-header .secondary {
    padding: 10px 8px;
    font-size: 10px;
  }
  .chat-heading .chat-subtitle {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
@media (max-width: 720px) {
  .login-page {
    display: block;
    min-height: 100dvh;
    background: #101820;
    padding: 70px 0;
  }
  .login-intro {
    display: none;
  }
  .login-card {
    margin: auto;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    margin-bottom: 55px;
    font-weight: 600;
  }
  .login-card h2 {
    font-size: 26px;
  }
  .workspace {
    display: block;
  }
  .rail {
    display: none;
  }
  .inbox {
    width: 100%;
    height: 100%;
    border: 0;
    padding-top: env(safe-area-inset-top);
  }
  .chat-area {
    display: none;
    width: 100%;
    height: 100%;
  }
  .workspace.chat-open .inbox {
    display: none;
  }
  .workspace.chat-open .chat-area {
    display: block;
  }
  .inbox-header {
    padding: 22px 23px 13px;
  }
  .inbox-header h1 {
    font-size: 26px;
  }
  .inbox-header .eyebrow {
    font-size: 9px;
  }
  #mobile-settings {
    display: inline-grid;
  }
  .account-filter {
    padding-bottom: 17px;
  }
  .conversation-item {
    padding: 17px 14px;
  }
  .conversation-list {
    padding: 7px 10px;
  }
  .contact-avatar {
    height: 45px;
    width: 45px;
    font-size: 16px;
  }
  .conversation-line strong {
    font-size: 14px;
  }
  .conversation-preview {
    font-size: 12px;
  }
  .inbox-footer {
    min-height: 28px;
    padding: 4px 16px calc(4px + env(safe-area-inset-bottom));
    flex-shrink: 0;
  }
  .chat-header {
    height: calc(74px + env(safe-area-inset-top));
    min-height: calc(74px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0 5px;
    gap: 8px;
  }
  #back-button {
    display: inline-grid;
    font-size: 35px;
    min-width: 30px;
    width: 30px;
  }
  .chat-header .contact-avatar {
    height: 34px;
    width: 34px;
    font-size: 13px;
  }
  .chat-heading .chat-name {
    font-size: 13px;
  }
  .chat-heading .chat-subtitle {
    font-size: 9px;
    max-width: 125px;
  }
  .chat-header .header-actions {
    gap: 2px;
  }
  .chat-header .secondary {
    font-size: 9px;
    max-width: 64px;
    padding: 8px;
    line-height: 1.4;
    min-height: 40px;
  }
  .chat-header .icon-button {
    min-width: 30px;
    width: 30px;
  }
  .messages {
    padding: 14px 12px;
  }
  .bubble {
    max-width: 86%;
    padding: 11px 13px;
  }
  .message-text {
    font-size: 14px;
  }
  .composer {
    margin: 0;
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: none;
  }
  .composer-toolbar {
    gap: 21px;
    padding: 8px 14px 0;
  }
  .tool {
    font-size: 23px;
    min-height: 38px;
  }
  .tool span {
    display: none;
  }
  .mode-label {
    font-size: 10px;
  }
  .composer textarea {
    font-size: 16px;
    min-height: 66px;
    max-height: 100px;
    padding: 8px 14px;
  }
  .composer-bottom {
    padding-bottom: 10px;
  }
  .composer-bottom > span {
    font-size: 9px;
  }
  .send {
    min-height: 40px;
    padding: 8px 19px;
  }
  .conversation-notice {
    font-size: 11px;
    padding: 10px 15px;
  }
  .empty-chat {
    padding: 20px;
  }
  .empty-chat h2 {
    font-size: 22px;
  }
  .empty-features {
    gap: 15px;
  }
  .attachment-bar {
    padding: 8px 14px;
    font-size: 11px;
  }
  dialog {
    max-width: 100%;
    width: 100%;
    max-height: 94dvh;
    border-radius: 18px 18px 0 0;
    margin: auto 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #dialog.settings-dialog[open] {
    width: 100%;
    height: 94dvh;
  }
  .settings-dialog .dialog-tabs {
    padding: 12px 18px 10px;
  }
  #dialog.settings-dialog .dialog-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 16px;
    scroll-padding-inline: 16px;
  }
  .account-card {
    padding: 13px;
  }
  .account-actions > button,
  .account-menu-actions button,
  .account-connection-details > summary,
  .account-diagnostics [data-connection-history] > summary {
    min-height: 44px;
  }
  .account-actions > .account-refresh {
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .account-connection-details {
    margin-top: 4px;
  }
  .account-connection-details > summary,
  .account-diagnostics [data-connection-history] > summary {
    align-content: center;
  }
  .settings-section {
    padding: 18px;
  }
  .dialog-header {
    padding: 13px 18px;
  }
  .dialog-header h2 {
    font-size: 16px;
  }
  #dialog-body {
    padding: 18px;
  }
  .dialog-tabs {
    gap: 2px;
  }
  .dialog-tabs button {
    padding: 8px 11px;
    font-size: 11px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: auto;
  }
  .form-grid input,
  .form-grid textarea,
  .form-grid select,
  form > label > input {
    font-size: 16px;
  }
  .coach-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .coach-footer .primary {
    width: 100%;
  }
  .toast {
    bottom: calc(25px + env(safe-area-inset-bottom));
    width: max-content;
  }
  .update-banner {
    width: calc(100% - 20px);
    font-size: 11px;
    padding: 10px;
  }
  .mobile-only {
    display: block;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

/* Shared dark surfaces and controls, including the PWA shell and dialogs. */
body {
  background: #101820;
}
.primary {
  background: #72e1b5;
  color: #09271d;
  font-weight: 750;
}
.primary:hover {
  background: #95efcd;
}
.secondary {
  background: #263a4b;
  border-color: var(--line);
  color: var(--text);
  font-weight: 600;
}
.secondary:hover {
  background: #334d62;
}
.danger {
  background: #4b2933;
  color: var(--danger);
}
input,
select,
textarea {
  background: #101923;
  border-color: #394d5c;
  color: var(--text);
}
input::placeholder,
textarea::placeholder {
  color: #a6b5c4;
  opacity: 1;
}
input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px #101923 inset;
}
::selection {
  background: #245f8c;
  color: #fff;
}
dialog::backdrop {
  background: #0009;
}
.secret-field {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
}
.secret-field input {
  width: 100%;
  min-width: 0;
  padding-right: 70px;
}
.secret-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 52px;
  height: 36px;
  font-size: 12px;
  color: var(--green);
  border-radius: 6px;
}
.secret-toggle:hover {
  background: var(--pale);
}
.model-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr auto;
  align-items: end;
  gap: 12px;
}
.model-row label {
  margin: 0;
  min-width: 0;
}
.model-row input,
.model-row select {
  width: 100%;
}
.qr-image {
  background: white;
  padding: 12px;
  border-radius: 12px;
}
@media (max-width: 700px) {
  .model-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .model-row button {
    justify-self: end;
  }
}

/* Native popups inherit the dark palette; the account picker uses a themed listbox. */
select,
option {
  color-scheme: dark;
}
option {
  background: #18232e;
  color: #e5edf4;
}
.account-picker {
  position: relative;
  min-width: 0;
  flex: 1;
}
#account-filter[hidden],
.account-menu[hidden],
.avatar-image[hidden] {
  display: none;
}
#account-filter-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: #22313f;
  color: #e5edf4;
  text-align: left;
  border: 1px solid #456073;
  border-radius: 10px;
  padding: 10px 12px;
}
.account-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 6px;
  background: #22313f;
  border: 1px solid #57748b;
  border-radius: 12px;
  box-shadow: 0 12px 32px #0008;
  max-height: 280px;
  overflow: auto;
}
.account-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #e5edf4;
  text-align: left;
}
.account-menu button[aria-selected="true"],
.account-menu button[aria-selected="true"]:hover {
  background: var(--selection);
  color: var(--blue);
  outline: none;
}
.account-menu button:hover:not([aria-selected="true"]) {
  background: #334d62;
}
.account-avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #245249;
  color: #c5ffea;
  font-weight: 750;
}
.account-all {
  background: #34495f;
  color: var(--blue);
  font-size: 24px;
}
.account-option-info {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.account-option-info strong {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-option-info small {
  color: #c6d8e4;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.account-chevron {
  flex-shrink: 0;
  color: var(--blue);
}
.contact-avatar {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-card {
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid #436885;
  border-radius: 14px;
  background: #172f46;
}
.unknown-contact-card {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  width: min(100%, 560px);
  margin: 4px auto 14px;
  padding: 12px;
  border: 1px solid #40536a;
  border-radius: 12px;
  background: #1b2734;
  color: #f2f5f7;
  text-align: left;
}
.unknown-contact-card.hidden {
  display: none;
}
.unknown-contact-avatar {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  font-size: 18px;
}
.unknown-contact-number,
.unknown-contact-name {
  display: block;
  overflow-wrap: anywhere;
}
.unknown-contact-number {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: 16px;
  line-height: 1.3;
}
.unknown-contact-name {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  color: #bec9d2;
  font-size: 12px;
  line-height: 1.4;
}
.unknown-contact-details {
  grid-column: 1 / -1;
  margin: 4px 0;
  color: #bec9d2;
  font-size: 12px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.unknown-contact-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.unknown-contact-actions button {
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}
.unknown-contact-block {
  background: #34404b;
  color: #ff8790;
}
.unknown-contact-add {
  background: #34404b;
  color: #f2f5f7;
}
.unknown-contact-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.unknown-contact-refresh {
  grid-column: 3;
  grid-row: 1 / span 2;
  min-height: 36px;
  padding: 6px 4px;
  background: none;
  border: 0;
  color: #9bc6df;
  font-size: 12px;
}
.unknown-contact-pending,
.unknown-contact-hint {
  grid-column: 1 / -1;
  margin: 4px 0;
  color: #f1ce8c;
  font-size: 12px;
  line-height: 1.5;
}
.profile-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-heading > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-avatar {
  width: 64px;
  height: 64px;
}
.profile-avatar-open {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: inherit;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.profile-avatar-open:focus-visible {
  outline-offset: -3px;
}
.profile-avatar .avatar-image:is([hidden], :not([src])) + button,
.media-viewer[data-avatar] :is(.viewer-message-action, .viewer-footer) {
  display: none;
}
.media-viewer[data-avatar] .viewer-photo .viewer-image {
  width: min(78vmin, 640px);
  height: auto;
  object-fit: contain;
}
.profile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.profile-details dt {
  color: #b7cee0;
  font-size: 12px;
  margin-bottom: 5px;
  font-weight: 600;
}
.profile-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 600;
}
.proxy-health.success {
  color: #6de1b0;
}
@media (max-width: 600px) {
  .unknown-contact-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 10px 12px;
  }
  .unknown-contact-actions button {
    min-height: 40px;
  }
  .unknown-contact-refresh {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: end;
    min-height: 36px;
  }
  .profile-details {
    grid-template-columns: 1fr;
  }
  .profile-heading {
    flex-wrap: wrap;
  }
}

/* State cues use text/weight/edges as well as color, throughout the workspace. */
.conversation-item.selected .conversation-line strong,
.conversation-item.unread .conversation-line strong {
  font-weight: 800;
}
.conversation-item.unread .conversation-preview {
  color: var(--ink);
  font-weight: 650;
}
.conversation-item.unread time {
  color: var(--green);
  font-weight: 700;
}
.conversation-item.selected .conversation-preview,
.conversation-item.selected .conversation-account,
.conversation-item.selected time {
  color: #c6e3fa;
}
.conversation-account > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.current-conversation {
  flex-shrink: 0;
  color: #dff1ff;
  background: #29597d;
  border: 1px solid #5991b8;
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 750;
}
.translation-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--message-translated);
  margin-bottom: 4px;
}
.message-status {
  font-weight: 700;
}
.message-status[data-status="read"] {
  color: #9dd8ff;
}
.message-status:is([data-status="accepted"], [data-status="delivered"]) {
  color: #a4f3d3;
}
.message-status:is(
  [data-status="queued"],
  [data-status="ready"],
  [data-status="preparing"],
  [data-status="sending"],
  [data-status="needs_review"],
  [data-status="delivery_unknown"]
) {
  color: var(--warning);
}
.message-status[data-status="failed"] {
  color: var(--danger);
}
.message-row:is(
    [data-status="failed"],
    [data-status="needs_review"],
    [data-status="delivery_unknown"]
  )
  .bubble {
  border-width: 2px;
}
.message-row[data-status="failed"] .bubble {
  border-color: #e98a95;
}
.message-row:is([data-status="needs_review"], [data-status="delivery_unknown"])
  .bubble {
  border-color: #d6ad5f;
}
.search:focus-within {
  outline: 2px solid var(--selection-edge);
  outline-offset: -2px;
}
.search input,
.composer textarea {
  background: transparent;
}
.rail-button.active {
  box-shadow: inset 3px 0 var(--green);
}
.rail-button:hover,
.icon-button:hover {
  outline: 1px solid #57748b;
}
.filter-tabs button:hover,
.dialog-tabs button:hover {
  color: var(--ink);
}
.filter-tabs button.selected span {
  background: var(--selection);
  color: var(--blue);
}
.account-menu button[aria-selected="true"] {
  box-shadow: inset 3px 0 var(--selection-edge);
  font-weight: 750;
}
.account-menu button:focus-visible {
  outline: 2px solid var(--selection-edge);
  outline-offset: -2px;
}
.profile-heading strong {
  font-size: 17px;
  font-weight: 750;
  color: var(--ink);
}
.profile-details > div {
  border-bottom: 1px solid #436885;
  padding-bottom: 10px;
}
.setting-card .error {
  color: var(--danger);
}
.setting-card .proxy-health.success {
  color: var(--green);
}
.status-pill[data-role="admin"] {
  color: var(--purple);
  background: var(--purple-bg);
}
.status-pill[data-role="inactive"] {
  color: var(--muted);
  background: #30404c;
}
.setting-card:has(.connection-failed) {
  border-color: #b75c6c;
}
.form-actions {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.tool:hover {
  filter: brightness(1.2);
}
#quick-compose {
  color: var(--warning);
}
#location-button {
  color: var(--blue);
}
.single-photo {
  display: block;
  padding: 0;
  max-width: 100%;
  border-radius: 6px;
}
.album-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 17px;
}
.album-row.out {
  justify-content: flex-end;
}
.album-bubble {
  width: 430px;
  max-width: 86%;
  padding: 5px;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.album-tile {
  position: relative;
  display: block;
  padding: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 7px;
  background: #101820;
}
.album-tile .media-image {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: inherit;
}
.album-grid.count-3 {
  grid-template-rows: repeat(2, 105px);
}
.album-preview-loading,
.album-preview-error {
  display: none;
  position: absolute;
  inset: 0;
  align-content: center;
  padding: 12px 8px 30px;
  background: #101820;
  color: #c6d8e4;
  font-size: 12px;
  text-align: center;
}
.album-tile[data-preview="loading"] .album-preview-loading,
.album-tile[data-preview="error"] .album-preview-error {
  display: grid;
}
.message-note {
  max-width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  color: #c6d8e4;
  overflow-wrap: anywhere;
}
.album-grid.count-3 .album-tile {
  aspect-ratio: auto;
}
.album-grid.count-3 .album-tile:first-child {
  grid-row: span 2;
}
.album-tile-meta {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 18px 7px 6px;
  color: #fff;
  background: linear-gradient(transparent, #000b);
  font-size: 11px;
}
.album-tile-number {
  display: none;
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 6px;
  border-radius: 5px;
  background: #101820cc;
  color: #fff;
  font-size: 11px;
}
.album-row[data-album-expanded] .album-tile-number { display: block; }
.album-row[data-album-expanded] .album-more { display: none; }
.album-expand { display: block; width: 100%; min-height: 44px; padding: 8px; font-size: 12px; color: var(--green); }
.viewer-reply-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: #172934; }
.viewer-reply-bar span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.viewer-reply-bar button { flex: none; min-height: 44px; white-space: nowrap; }
.viewer-reply-bar[hidden] { display: none; }
@media (max-width: 480px) {
  .viewer-reply-bar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .viewer-reply-bar span { max-width: 120px; font-size: 11px; }
  .viewer-reply-bar button { font-size: 13px; padding: 8px 12px; }
}
.album-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0009;
  color: #fff;
  font-size: 48px;
  font-weight: 500;
}
.album-caption,
.album-translation {
  padding: 9px 10px 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.album-translation {
  color: #c6d8e4;
  font-size: 13px;
}
.album-details {
  padding: 8px 6px 3px;
  font-size: 12px;
}
.album-details summary {
  padding: 5px;
  cursor: pointer;
  color: #c6d8e4;
}
.album-details .album-attention {
  color: var(--warning);
  font-weight: 700;
}
.album-details .message-row {
  margin: 8px 0;
}
.album-details .bubble {
  max-width: 100%;
  width: 100%;
  padding: 7px 10px;
  box-shadow: none;
}
.album-details .message-text:empty {
  display: none;
}
.album-details .message-meta {
  margin-top: 2px;
  justify-content: flex-start;
}
.album-details .message-error {
  max-width: 100%;
}
.media-viewer {
  width: min(1100px, calc(100vw - 24px));
  height: min(900px, 94dvh);
  max-height: 94dvh;
  margin: auto;
  background: #101820;
}
.media-viewer[open] {
  display: flex;
  flex-direction: column;
}
.viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.viewer-counter {
  flex: 1;
  font-size: 15px;
}
.viewer-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  position: relative;
}
.viewer-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.viewer-footer {
  padding: 0 20px 12px;
  max-height: 22dvh;
  overflow: auto;
}
.viewer-caption {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0;
}
.viewer-status {
  font-size: 12px;
  color: var(--muted);
}
.viewer-error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #18232e;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}
.viewer-error[hidden] {
  display: none;
}
.viewer-error button {
  margin-top: 10px;
}
@media (max-width: 720px) {
  .album-bubble {
    max-width: 92%;
  }
  .album-grid.count-3 {
    grid-template-rows: repeat(2, 85px);
  }
  .album-more {
    font-size: 36px;
  }
  .viewer-stage {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 4px;
    padding: 5px;
  }
  .viewer-stage .icon-button {
    min-width: 30px;
    width: 30px;
  }
  .viewer-header {
    padding: 8px;
    gap: 8px;
  }
}
input,
textarea,
select {
  font-weight: 400;
}
tbody tr:hover {
  background: #263a4b;
}
@media (max-width: 720px) {
  .chat-heading .chat-name {
    font-size: 15px;
  }
  .chat-heading .chat-subtitle {
    font-size: 11px;
  }
  .composer-toolbar {
    gap: 10px;
  }
  .composer-bottom > span {
    font-size: 10px;
  }
}

.album-photo-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 5px;
  text-align: left;
}

/* Dense inbox and a readable conversation column, independent of monitor width. */
.conversation-list {
  padding: 0;
  min-height: 0;
  overflow-anchor: none;
}
.conversation-window {
  position: relative;
  width: 100%;
}
.conversation-window .conversation-item {
  position: absolute;
  left: 6px;
  width: calc(100% - 12px);
  margin: 0;
  padding: 7px 10px;
  gap: 10px;
  border-radius: 7px;
}
.conversation-window .conversation-preview {
  margin-top: 3px;
  line-height: 18px;
}
.conversation-window .conversation-account {
  margin-top: 2px;
  min-height: 16px;
  line-height: 16px;
  font-size: 10px;
}
.conversation-window .current-conversation {
  padding: 0 4px;
  font-size: 9px;
}
.conversation-window .badge {
  margin-top: 0;
  height: 18px;
  min-width: 18px;
}
.inbox-header {
  padding: 18px 20px 12px;
}
.inbox-header h1 {
  font-size: 24px;
}
.account-filter {
  padding-bottom: 12px;
}
.filter-tabs {
  padding-top: 12px;
}
.filter-tabs button {
  padding-bottom: 10px;
}
.chat-header {
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.messages {
  padding: 14px max(18px, calc((100% - 960px) / 2));
}
.message-row {
  margin-bottom: 7px;
}
.bubble {
  max-width: min(78%, 520px);
  padding: 7px 10px;
}
.message-text {
  line-height: 1.5;
}
.message-translation {
  margin-top: 5px;
  padding-top: 5px;
  line-height: 1.5;
}
.message-meta {
  margin-top: 4px;
}
.translation-label {
  display: inline;
  margin-right: 6px;
}
.album-row {
  margin-bottom: 9px;
}
.album-bubble {
  width: 430px;
  max-width: 86%;
  padding: 5px;
}
.composer {
  width: calc(100% - 36px);
  max-width: 960px;
  margin: 0 auto 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  padding: 6px 10px 8px;
}
.composer-toolbar {
  grid-column: 1 / -1;
  padding: 0;
  gap: 12px;
}
.composer .tool {
  min-height: 30px;
}
.composer textarea {
  grid-column: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  line-height: 1.5;
  border-radius: 22px;
  background: #263645;
  align-self: end;
}
.composer textarea:focus-visible {
  box-shadow: inset 0 0 0 1px var(--selection-edge);
}
.composer-bottom {
  display: contents;
}
.composer-bottom > span {
  grid-column: 1 / -1;
  grid-row: 3;
}
.composer .send {
  grid-column: 2;
  grid-row: 2;
  min-height: 44px;
  max-width: 130px;
  padding: 10px 12px;
  align-self: end;
  border-radius: 22px;
}
.send-mode-status {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
#preferences-result {
  display: block;
  padding-top: 8px;
  color: var(--green);
}
@media (max-width: 720px) {
  .messages {
    padding: 10px 12px;
  }
  .composer {
    width: 100%;
    margin: 0;
    border-radius: 0;
    padding: 4px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .composer-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(44px, 1fr)) auto;
    gap: 8px;
  }
  .composer .tool {
    min-height: 44px;
    min-width: 44px;
    width: 100%;
    justify-content: center;
    padding: 0;
  }
  .composer .tool span,
  .composer #attach-button span,
  .composer .toolbar-spacer,
  .composer-bottom > span:not(.important-hint) {
    display: none;
  }
  .composer textarea {
    font-size: 16px;
  }
  .album-bubble {
    max-width: 92%;
  }
  .send-mode-status {
    font-size: 10px;
  }
}
.filter-tabs {
  gap: 8px;
  padding: 10px 16px;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}
.chat-filter-scroll {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  min-width: 0;
  flex: 1;
  scrollbar-width: thin;
  padding: 2px 0 5px;
}
.filter-tabs button {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 12px;
  background: var(--surface, #18232d);
}
.filter-tabs button.selected {
  background: #153d35;
  color: #b5f3da;
  border-color: #397967;
}
.filter-tabs .chat-list-add {
  font-size: 23px;
  width: 38px;
  height: 38px;
  justify-content: center;
  padding: 0;
}
.list-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
}
.list-color-green {
  background: #93b247;
}
.list-color-gold {
  background: #c5a63d;
}
.list-color-pink {
  background: #bc3b87;
}
.list-color-blue {
  background: #519ee5;
}
.list-color-purple {
  background: #a783de;
}
.list-color-red {
  background: #d5616d;
}
.list-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.list-colors .list-color-option {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.list-color-option input,
.list-member input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: #5bc4a1;
}
.list-members {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  margin: 12px 0;
}
.list-members .list-member {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 8px;
  cursor: pointer;
}
.list-member[hidden] {
  display: none;
}
.list-member span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.list-member small {
  display: block;
  opacity: 0.7;
  margin-top: 3px;
}
.list-management {
  display: grid;
  gap: 10px;
}
.list-management button {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-wrap: anywhere;
  text-align: left;
}
.list-management button small {
  margin-left: auto;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .filter-tabs {
    padding: 8px 12px;
  }
  .filter-tabs button {
    min-height: 38px;
  }
  .list-colors {
    gap: 12px;
  }
}
.list-colors .list-color-option,
.list-members .list-member {
  flex-direction: row;
}
/* Read-only picker overlays history without increasing composer height. */
.composer {
  position: relative;
}
.quick-reply-picker {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #17242d;
  box-shadow: 0 -8px 28px #0004;
}
.quick-reply-picker[hidden] {
  display: none;
}
.quick-reply-picker header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 44px;
  padding: 0 16px;
  color: var(--muted);
  background: #132029;
  font-size: 13px;
}
.quick-reply-picker header button {
  min-height: 40px;
  min-width: 40px;
  font-size: 24px;
}
#quick-reply-options {
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  min-height: 0;
}
#quick-reply-options [role="option"] {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 16px;
  min-height: 70px;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
#quick-reply-options [role="option"]:hover,
#quick-reply-options [role="option"][aria-selected="true"] {
  background: #233b47;
}
.quick-reply-title {
  font-size: 13px;
  color: #a8b9c2;
}
.quick-reply-text {
  font-size: 16px;
  line-height: 1.45;
  color: #f0f5f6;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.quick-reply-empty {
  padding: 18px 16px;
  color: var(--muted);
  font-size: 13px;
}
.quick-reply-empty button {
  color: var(--green);
  padding: 8px;
}
.quick-reply-picker [hidden] { display: none !important; }
.quick-reply-picker [data-picker-count] { flex: 1; font-size: 12px; }
.quick-reply-picker header { gap: 8px; }
.quick-reply-picker header strong { color: var(--ink); }
.reply-picker-filters { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 6px 12px 9px; }
.reply-picker-filters input { grid-column: 1 / -1; }
.reply-picker-filters > * { min-height: 34px; padding: 5px 8px; font-size: 13px; }
#quick-reply-options .quick-reply-text { -webkit-line-clamp: 1; color: var(--muted); font-size: 13px; }
#quick-reply-options strong { color: var(--ink); font-size: 14px; }
#quick-reply-options .quick-reply-title { color: var(--muted); font-size: 11px; }
.reply-picker-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.reply-preview-scroll { padding: 0 14px 12px; }
.reply-preview-heading { gap: 6px; }
.reply-preview-heading .text-button { min-height: 34px; padding-left: 0; }
.reply-preview-scroll h3 { font-size: 15px; }
.reply-preview-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reply-preview-controls select { padding: 5px 8px; min-height: 34px; font-size: 13px; }
.reply-preview-body { line-height: 1.65; font-size: 14px; white-space: pre-wrap; margin: 8px 0 0; }
.reply-picker-preview footer { padding: 7px 12px; border-top: 1px solid var(--line); }
.reply-picker-preview footer small { color: var(--warning); font-size: 11px; line-height: 1.45; }
.reply-picker-preview footer .primary { padding: 8px 12px; margin-left: auto; }
@media (max-height: 550px) {
  .quick-reply-picker header { height: 32px; }
  .reply-picker-filters { padding-block: 2px; }
}
#mobile-quick-open {
  display: none;
}
@media (max-width: 720px) {
  #mobile-quick-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .quick-reply-picker {
    bottom: calc(100% + 1px);
    border-radius: 12px 12px 0 0;
  }
}

.order-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
  color: var(--muted);
  font-size: 13px;
}
.order-pagination button {
  min-height: 36px;
}
.center-heading {
  flex-wrap: wrap;
}
/* Continuous album: each original image keeps its own caption and delivery state. */
.media-viewer {
  padding: 0;
  overflow: hidden;
  background: #080b0d;
}
.viewer-gallery {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  overflow-anchor: none;
}
.viewer-photo {
  margin: 0 auto 16px;
  max-width: 760px;
}
.viewer-photo-stage {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
}
.viewer-photo-stage[data-zoomed="true"] {
  cursor: grab;
}
.viewer-photo-stage[data-dragging="true"] {
  cursor: grabbing;
}
.viewer-zoom-reset {
  white-space: nowrap;
  font-size: 12px;
  min-height: 40px;
  padding: 6px 10px;
}
.viewer-zoom-reset[hidden] {
  display: none;
}
.viewer-photo .viewer-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto 3 / 4;
  object-fit: contain;
  transform-origin: center;
}
.viewer-photo .viewer-footer {
  max-height: none;
  overflow: visible;
  padding: 4px 14px 8px;
}
.viewer-photo .viewer-caption:empty {
  display: none;
}
.viewer-header {
  flex-shrink: 0;
}
#composer-more {
  display: none;
}
@media (max-width: 720px) {
  html,
  body {
    touch-action: pan-x pan-y;
  }
  .media-viewer {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .media-viewer .viewer-header {
    padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  }
  .viewer-gallery {
    padding-bottom: env(safe-area-inset-bottom);
  }
  #workspace .composer {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 4px;
    padding: 5px 6px
      calc(5px + var(--chat-safe-bottom, env(safe-area-inset-bottom)));
  }
  #composer-more {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    width: 44px;
    height: 44px;
    font-size: 30px;
    background: transparent;
    border: 0;
  }
  #workspace .composer textarea {
    grid-column: 2;
    grid-row: 1;
    min-height: 44px;
    max-height: 100px;
    padding: 10px 12px;
    font-size: 16px;
  }
  #workspace .composer .send {
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
  }
  #workspace .composer .send::after {
    content: "↑";
    font-size: 26px;
  }
  #workspace .composer .send[data-pending="true"]::after {
    content: "!";
  }
  #workspace .composer .send[data-sending="true"]::after {
    content: "…";
  }
  #workspace .composer-toolbar {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 8px;
    right: 8px;
    padding: 12px;
    border: 1px solid #3c5362;
    border-radius: 16px;
    background: #182733;
    box-shadow: 0 8px 25px #0007;
    z-index: 15;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  #workspace .tools-open .composer-toolbar {
    display: grid;
  }
  #workspace .composer-toolbar .tool {
    padding: 8px;
    gap: 8px;
  }
  #workspace .composer-toolbar .tool span {
    display: inline;
    font-size: 13px;
  }
  #workspace .composer-toolbar .send-mode-status {
    grid-column: 1 / -1;
    text-align: center;
  }
  #workspace .composer-hint,
  #workspace #composer-hint {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  #workspace.keyboard-open .composer {
    padding-bottom: 5px;
  }
  #workspace .chat-header {
    height: calc(56px + env(safe-area-inset-top));
    min-height: calc(56px + env(safe-area-inset-top));
  }
}

@media (max-width: 720px) {
  #workspace
    .composer
    .send[data-translate="true"][data-pending="false"][data-sending="false"]::after {
    content: "译↑";
    font-size: 16px;
  }
}

/* Compact inbox header: controls, account and search form one continuous area. */
.inbox-top {
  flex-shrink: 0;
  min-width: 0;
  padding: 10px 14px 6px;
  display: grid;
  gap: 6px;
}
.inbox-top .inbox-header {
  padding: 0;
  min-height: 44px;
}
.inbox-top .inbox-header .eyebrow {
  display: none;
}
.inbox-top .inbox-header h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}
.inbox-top .header-actions {
  gap: 4px;
}
.inbox-top .header-actions .icon-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
}
.inbox-top .account-filter {
  padding: 0;
  gap: 8px;
}
.inbox-top #account-filter-button {
  min-height: 44px;
  padding: 5px 9px;
  gap: 8px;
}
.inbox-top #account-filter-button .account-avatar {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  font-size: 18px;
}
.inbox-top #account-filter-button .account-option-info {
  gap: 1px;
}
.inbox-top #account-filter-button .account-option-info strong {
  font-size: 13px;
}
.inbox-top #account-filter-button .account-option-info small {
  font-size: 11px;
}
.inbox-top #account-filter-button[data-scope="all"] .account-option-info small {
  display: none;
}
.inbox-top .search {
  margin: 0;
  height: 40px;
  border-radius: 20px;
}
.inbox-top .search input {
  padding: 8px 0;
  font-size: 16px;
  line-height: 24px;
}
.account-presence {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  font-size: 11px;
  line-height: 15px;
  white-space: nowrap;
}
.presence-online {
  color: var(--green);
}
.presence-offline {
  color: var(--danger);
}
.presence-pending {
  color: var(--amber, #e4b363);
}
@media (min-width: 721px) {
  #workspace .account-menu {
    min-width: 360px;
    max-width: calc(100vw - 32px);
  }
}
.inbox-footer {
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 22px;
  padding: 3px 14px;
  flex-shrink: 0;
}
.inbox-footer .connection {
  color: var(--green);
  font-size: 10px;
  line-height: 14px;
}
.inbox-footer .connection i {
  width: 5px;
  height: 5px;
  background: currentColor;
}
.inbox-footer .connection.offline {
  color: var(--danger);
}
@media (max-width: 720px) {
  .inbox-top {
    padding-top: 6px;
  }
  .inbox-footer {
    padding-bottom: calc(3px + env(safe-area-inset-bottom));
  }
  .inbox-footer .version {
    display: none;
  }
}

/* Keep the update action away from the system status bar and keyboard. */
.update-banner {
  top: var(--update-center, 50%);
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100% - 32px));
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  text-align: center;
  border-radius: 18px;
  box-shadow: 0 16px 60px #0009;
  font-size: 14px;
}
.update-banner #update-now {
  min-height: 48px;
  width: 100%;
}
.update-banner #update-later {
  min-height: 44px;
  width: 100%;
}
.update-status { margin: 0; font-size: 12px; line-height: 1.6; }
.update-status:empty { display: none; }
.version[role="button"] { cursor: pointer; }
.chat-header .chat-heading .chat-subtitle {
  color: var(--green);
  font-size: 11px;
  line-height: 15px;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  overflow: visible;
}
.chat-header .chat-contact {
  align-items: center;
}
.chat-header .header-actions {
  align-items: center;
}
.chat-assistant-symbol,
.chat-order-compact {
  display: none;
}
@media (max-width: 720px) {
  #workspace .chat-header {
    height: auto;
    min-height: calc(56px + var(--chat-safe-top, env(safe-area-inset-top)));
    padding: calc(6px + var(--chat-safe-top, env(safe-area-inset-top))) 10px 6px
      5px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
  }
  #workspace .chat-header .chat-contact {
    min-height: 44px;
    padding: 0;
    gap: 8px;
  }
  #workspace .chat-header .chat-heading .chat-name {
    margin-bottom: 2px;
    line-height: 18px;
  }
  #workspace .chat-header .header-actions {
    align-self: center;
  }
  #workspace .chat-header .secondary {
    height: 44px;
    min-height: 44px;
    padding: 6px;
    max-width: 64px;
  }
  #workspace .chat-header #back-button {
    height: 44px;
  }
  #workspace .chat-header #chat-assistant-open {
    width: 44px;
    min-width: 44px;
    padding: 6px;
  }
  .chat-assistant-symbol {
    display: inline;
    font-size: 21px;
  }
  .chat-order-compact {
    display: inline;
  }
  .chat-assistant-label,
  .chat-order-label {
    display: none;
  }
}

/* Native links keep the browser's long-press open/copy menu. */
.message-link {
  direction: ltr;
  unicode-bidi: isolate;
  color: #83caff;
  text-decoration: underline;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
.message-text {
  user-select: text;
  -webkit-user-select: text;
}
.gif-media {
  position: relative;
  max-width: 320px;
}
.gif-media .media-video,
.gif-media .media-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
}
.gif-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #0008;
  color: #fff;
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 10px;
  pointer-events: none;
}
.media-sticker {
  display: block;
  width: 160px;
  max-width: 100%;
  height: 160px;
  object-fit: contain;
}
wa-link-preview {
  display: block;
  width: 320px;
  max-width: 100%;
  margin: 4px 0 8px;
  overflow: hidden;
  border-radius: 9px;
}
.link-preview-card {
  display: block;
  color: inherit;
  text-decoration: none;
  background: #101b2180;
  border: 1px solid #ffffff12;
  border-radius: 9px;
  overflow: hidden;
}
.link-preview-image {
  display: block;
  width: 100%;
  height: 210px;
  object-fit: contain;
  background: #fff;
}
.link-preview-copy {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  font-size: 13px;
}
.link-preview-copy strong {
  font-size: 14px;
  color: #e9edef;
}
.link-preview-description,
.link-preview-copy strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.link-preview-description,
.link-preview-site {
  color: #aebac1;
}
.link-preview-site {
  overflow-wrap: anywhere;
}
.link-preview-unavailable,
.speech-status {
  font-size: 12px;
  color: #aebac1;
}
.speech-status {
  display: block;
  margin: 6px 0;
}
wa-animated-sticker {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
wa-animated-sticker svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.quote-thumbnail wa-animated-sticker {
  position: absolute;
  inset: 0;
}
.sticker-bubble {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 4px !important;
}
#expression-toggle {
  grid-column: 1;
  grid-row: 2;
  justify-self: end;
  align-self: end;
  margin: 0 4px 2px 0;
  width: 40px;
  height: 40px;
  z-index: 1;
  background: transparent;
  border: 0;
  font-size: 26px;
}
#workspace .composer textarea {
  padding-right: 48px;
}
.expression-panel {
  flex-shrink: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  background: #182733;
  border-top: 1px solid #344b58;
}
.expression-panel[hidden] {
  display: none;
}
.expression-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}
.expression-tabs button {
  min-height: 40px;
  padding: 6px 16px;
  border: 0;
  border-radius: 20px;
  background: transparent;
}
.expression-tabs [aria-selected="true"] {
  background: #265246;
  color: #72e1b5;
}
.expression-tabs [data-close] {
  margin-left: auto;
}
.expression-content {
  height: min(280px, 32dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 4px;
}
.emoji-choice {
  font-size: 28px;
  background: transparent;
  border: 0;
  min-height: 44px;
  padding: 4px;
}
.expression-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.expression-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
}
.expression-grid button {
  background: transparent;
  border: 0;
  padding: 4px;
  min-height: 90px;
}
.expression-grid img,
.expression-grid wa-animated-sticker,
.expression-grid video {
  width: 100%;
  height: 82px;
  object-fit: contain;
}
.expression-grid > .helper {
  grid-column: 1/-1;
}
.expression-note {
  font-size: 11px;
}
@media (max-width: 720px) {
  #expression-toggle {
    grid-column: 2;
    grid-row: 1;
  }
  .expression-panel {
    margin: 0;
  }
}

@media (min-width: 721px) {
  #workspace .composer textarea {
    grid-row: 2;
  }
}

@media (max-width: 720px) {
  #workspace #active-chat:has(.expression-panel:not([hidden])) .composer {
    padding-bottom: 5px;
    margin-bottom: 0;
  }
}

.call-record .bubble {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
}
.call-record-icon {
  grid-row: span 2;
  align-self: center;
  font-size: 24px;
  color: var(--muted);
}
.call-record .message-meta {
  grid-column: 2;
}

.incoming-media-placeholder {
  display: grid;
  gap: 8px;
  padding: 14px;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.incoming-media-placeholder small {
  color: var(--muted);
  max-width: 260px;
}
/* Video opens as a separate viewer; the chat thumbnail never resizes for playback. */
.video-viewer {
  width: min(1100px, 100vw);
  max-width: 100vw;
  height: min(960px, 100dvh);
  max-height: 100dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  background: #07090b;
  color: #f5f6f6;
  border: 0;
  color-scheme: dark;
}
.video-viewer[open] {
  display: flex;
  flex-direction: column;
}
.video-viewer::backdrop {
  background: #000d;
}
.video-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 8px 14px;
}
.video-heading {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding-right: 44px;
}
.video-sender,
.video-date {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-sender {
  font-size: 14px;
}
.video-date {
  font-size: 11px;
  color: #b5bdc3;
  margin-top: 2px;
}
.video-viewer button {
  background: transparent;
  border: 0;
  color: #f5f6f6;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: 22px;
}
.video-viewer button:hover {
  background: #ffffff15;
}
.video-close {
  font-size: 36px;
  line-height: 1;
}
.video-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 14px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.video-seek {
  flex: 1;
  min-width: 0;
  width: 0;
  height: 36px;
  margin: 0;
  padding: 0;
  accent-color: #f5f6f6;
  border: 0;
  background: transparent;
  touch-action: none;
}
.video-stage {
  flex: 1;
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: none;
}
.viewer-video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  display: block;
}
.video-notice {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  max-width: 90%;
  border-radius: 8px;
  background: #000b;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.video-notice:empty,
.video-caption:empty {
  display: none;
}
.video-caption {
  flex-shrink: 0;
  max-height: 12dvh;
  overflow: auto;
  margin: 0;
  padding: 6px 16px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.video-controls {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px 14px;
}
.video-play {
  font-size: 24px;
}
.video-mute {
  position: absolute;
  right: 14px;
  font-size: 12px;
}
@media (max-width: 720px) {
  .video-viewer {
    width: 100%;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .video-header {
    padding-top: calc(6px + env(safe-area-inset-top));
  }
  .video-controls {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}
/* Original/wire text sits above its translation, like a compact chat bubble. */
.message-copy [dir="auto"],
#draft-translation-text,
#composer {
  /* Each newline may begin a paragraph in a different writing direction. */
  unicode-bidi: plaintext;
}
.message-a11y-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.message-role {
  margin: 0 0 5px;
  color: #c1ceca;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0.02em;
}
.message-role.role-agent {
  color: #a7d8c6;
}
.message-role.message-a11y-label {
  margin: -1px;
  padding: 0;
}
.message-copy {
  min-width: 0;
}
.message-primary
  > :is(.message-text, .message-translation, .message-sent-text) {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--message-original);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.message-secondary {
  border-top: 1px dashed #bed2d24d;
  margin-top: 6px;
  padding-top: 6px;
}
.message-secondary
  > :is(.message-text, .message-translation, .message-sent-text) {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--message-translated);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.message-language-label,
.message-language-note {
  font-size: 10px;
  line-height: 1.5;
  font-weight: 400;
  color: #b0bfbe;
}
.message-language-label {
  margin-bottom: 3px;
}
.message-language-note {
  margin-top: 5px;
}
.message-text.message-unavailable {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.message-row.system-notice {
  align-items: center;
  margin: 10px 0 14px;
}
.system-notice-card {
  max-width: min(92%, 560px);
  padding: 7px 12px;
  border: 1px solid #465056;
  border-radius: 8px;
  background: #293136;
  color: #d1d5d8;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}
.system-notice-label,
.system-notice-card time {
  display: block;
  color: #b1b9bf;
  font-size: 10px;
}
.system-notice-text {
  margin: 2px 0;
  white-space: pre-wrap;
  user-select: text;
}
.message-meta .text-button {
  color: #a9bcb5;
  font-weight: 400;
  font-size: 10px;
}
.message-meta .text-button:hover {
  color: var(--green);
}
.message-status-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.message-status-icon svg {
  width: 19px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#workspace .message-row > .bubble:not(.sticker-bubble):not(.album-bubble) {
  --bubble-color: #262a2b;
  width: fit-content;
  min-width: 72px;
  max-width: min(78%, 680px);
  padding: 7px 10px 5px;
  background: var(--bubble-color);
  border: 0;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 1px #0002;
}
#workspace .message-row.out > .bubble:not(.sticker-bubble):not(.album-bubble) {
  --bubble-color: #164e3d;
  border-radius: 8px 0 8px 8px;
}
#workspace
  .message-row:not(.call-record)
  > .bubble:not(.sticker-bubble):not(.album-bubble)::before {
  content: "";
  position: absolute;
  top: 0;
  left: -7px;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-top-color: var(--bubble-color);
  border-right-width: 0;
}
#workspace
  .message-row.out
  > .bubble:not(.sticker-bubble):not(.album-bubble)::before {
  left: auto;
  right: -7px;
  border-right-width: 7px;
  border-left-width: 0;
}
#workspace .message-meta {
  gap: 5px;
  min-height: 19px;
  margin-top: 3px;
  color: #b7c3bf;
  line-height: 1.25;
}
#workspace .message-meta > .text-button:first-child {
  margin-right: auto;
  padding: 2px 0;
}
#workspace .message-status[data-status="read"] {
  color: #53bdeb;
}
.album-bubble > .message-role {
  padding: 3px 5px 0;
}
.album-bubble > .message-copy {
  padding: 5px;
}
.sticker-bubble > .message-role {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 5px;
  background: #17221eb3;
}
@media (max-width: 720px) {
  #workspace .message-row > .bubble:not(.sticker-bubble):not(.album-bubble) {
    max-width: min(88%, 680px);
  }
}

.draft-translation-preview {
  flex: 0 0 auto;
  min-width: 0;
  padding: 8px 16px 9px;
  border-top: 1px solid #557e754d;
  background: #19332de8;
  color: #e9edef;
}
.draft-translation-preview[hidden] {
  display: none;
}
.draft-translation-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 10px;
  font-size: 11px;
  color: #b4d3c9;
}
.draft-translation-heading strong {
  font-weight: 500;
}
#draft-translation-state {
  margin-left: auto;
}
#draft-translation-text {
  max-height: min(16dvh, 120px);
  margin-top: 5px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-family: var(--chat-font, var(--font-ui));
  font-size: calc(15px + var(--chat-font-delta, 0px));
  line-height: 1.5;
  user-select: text;
}
#draft-translation-text:empty {
  margin: 0;
}
.draft-translation-preview[data-state="error"] {
  background: #3a2f25;
}
@media (max-width: 720px) {
  .draft-translation-preview {
    padding: 7px 12px;
  }
  #draft-translation-text {
    max-height: 96px;
  }
}

/* Compact Chinese suggestions: actions remain above the scrolling text. */
.coach-panel {
  flex: 0 0 auto;
  min-width: 0;
  padding: 4px 14px;
  border-top: 1px solid var(--line);
  background: var(--soft);
  font-size: 13px;
  line-height: 1.4;
}
.coach-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.coach-status > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.coach-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.coach-panel .coach-status button {
  min-height: 30px;
  height: 30px;
  margin: 0;
  padding: 3px 9px;
  font-size: 12px;
  line-height: 1.2;
  flex-shrink: 0;
  white-space: nowrap;
}
.coach-details {
  max-height: min(15vh, 106px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 2px 2px 0;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}
.coach-intent-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.coach-intent-row > span:last-child {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.coach-panel .coach-label {
  margin: 0 0 2px;
  line-height: 1.4;
  letter-spacing: 0;
}
.coach-intent-row .coach-label {
  flex-shrink: 0;
  margin: 0;
}
.coach-panel .coach-translation {
  padding: 4px 8px;
  line-height: 1.4;
  font-size: 13px;
  border-radius: 5px;
}
/* The send button still shows the mode; its duplicate floating badge must not cover AI controls. */
@media (min-width: 721px) {
  #workspace #coach-panel:not(.hidden) ~ .composer .send-mode-status {
    display: none;
  }
}
@media (max-width: 720px) {
  .coach-status {
    flex-wrap: wrap;
    column-gap: 4px;
    row-gap: 2px;
  }
  .coach-status > span {
    flex-basis: calc(100% - 60px);
  }
  .coach-controls {
    order: 2;
    flex: 0 0 100%;
    justify-content: flex-end;
    gap: 6px;
  }
  .coach-panel .coach-status button {
    padding-inline: 7px;
  }
  .coach-details {
    max-height: min(15vh, 80px);
  }
}

/* AI results fill the composer; the panel only shows intent and actions. */
.coach-reference-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
}
.coach-reference-bar > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.coach-reference-bar button {
  flex-shrink: 0;
  padding: 4px 2px;
  font-size: 12px;
}
.customer-agent {
  flex-shrink: 0;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: #18232e;
  font-size: 12px;
}
.customer-agent summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 20px;
  cursor: pointer;
}
.customer-agent summary::before {
  content: "▸";
  color: var(--accent);
}
.customer-agent details[open] summary::before {
  content: "▾";
}
.customer-agent summary strong,
.customer-agent-model-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.customer-agent summary strong {
  max-width: 35%;
}
.customer-agent-model-label {
  flex: 1;
  color: var(--muted);
}
.customer-agent [data-agent-state] {
  flex-shrink: 0;
  color: var(--accent);
}
.customer-agent-body {
  max-height: min(48dvh, 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 10px;
}
.customer-agent-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 10px;
}
.customer-agent label {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin-bottom: 8px;
}
.customer-agent input,
.customer-agent select,
.customer-agent textarea {
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.customer-agent textarea {
  min-height: 84px;
  resize: vertical;
}
.customer-agent-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.customer-agent .helper,
#customer-agent-status {
  margin: 6px 0;
  overflow-wrap: anywhere;
}
.customer-agent button {
  padding: 7px 10px;
  font-size: 12px;
}
.customer-agent-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 0;
  min-width: 0;
}
.customer-agent-toolbar button {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 16px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-agent-toolbar button[aria-pressed="true"] {
  background: #234b43;
  border-color: var(--accent);
}
.customer-agent-library {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.customer-agent-library-label {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
}
.customer-agent-library .helper {
  white-space: nowrap;
  font-size: 11px;
}
.customer-agent-advanced {
  margin-top: 6px;
}
.customer-agent-advanced > summary {
  padding: 5px 0;
  min-height: 30px;
  color: var(--muted);
}
.coach-details {
  margin-top: 3px;
}
.coach-status > span > strong {
  display: inline-block;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.coach-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 0;
}
#coach-close {
  font-size: 21px;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
}
.coach-review-badge {
  color: #ffda8a;
  font-size: 12px;
}
@media (max-width: 720px) {
  .customer-agent-toolbar {
    padding: 5px 8px 0;
    gap: 5px;
  }
  .customer-agent-toolbar button {
    padding: 5px 6px;
    font-size: 11px;
  }
  #coach-close {
    min-width: 44px;
    min-height: 44px;
  }
  .customer-agent summary {
    gap: 6px;
    min-height: 44px;
    padding: 8px 10px;
  }
  .customer-agent-body {
    padding: 0 10px 10px;
  }
  .customer-agent-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-agent input,
  .customer-agent select,
  .customer-agent textarea {
    font-size: 16px;
  }
}
.coach-panel {
  font-size: 14px;
  line-height: 1.6;
}
.coach-panel .coach-details {
  max-height: min(34dvh, 300px);
  padding-block: 8px;
}
.coach-panel .coach-status > span {
  white-space: normal;
}
.coach-warning {
  color: #ffda8a;
  background: #322d21;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}
.coach-conflict {
  color: #ffb0b5;
  background: #38272e;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}
.coach-trace,
.coach-review-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 4px 0 8px;
}
.coach-trace small {
  display: block;
  overflow-wrap: anywhere;
}
.coach-review-check {
  font-size: 12px;
}
.coach-context-form {
  font-size: 14px;
  line-height: 1.6;
}
.coach-result-body {
  max-height: min(32dvh, 280px);
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  padding: 6px 2px 2px 0;
  scrollbar-width: thin;
}
.coach-assessment-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--muted);
}
.coach-stage {
  flex-shrink: 0;
  color: var(--green);
}
.coach-assessment .coach-label {
  min-width: 5em;
  font-size: 12px;
}
.coach-assessment-uncertainty {
  margin: 5px 0;
  color: #ffda8a;
  font-size: 12px;
}
.coach-reference-warning { border-left:2px solid var(--warning); background:#322d21; padding:7px 9px; margin:5px 0 8px; color:var(--warning); font-size:12px; line-height:1.55; }
.coach-reference-warning p { margin:4px 0; }
.coach-reference-warning .text-button { font-size:12px; padding:3px 0; }
.coach-coverage-summary { display:flex; align-items:center; flex-wrap:wrap; gap:4px 12px; margin:6px 0; font-size:12px; }
.coach-workcheck, .coach-product-reference, .coach-usage { font-size:12px; color:var(--muted); margin-top:6px; }
.coach-workcheck summary, .coach-product-reference summary, .coach-usage summary { cursor:pointer; padding:3px 0; }
.coach-request-list { list-style:none; padding:0; margin:8px 0; }
.coach-request-list li { padding:7px 9px; border-left:2px solid var(--line); margin-top:6px; background:var(--soft); }
.coach-request-list li > div, .coach-product-heading { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 10px; }
.coach-request-list strong { color:var(--ink); font-weight:550; }
.coach-request-list p, .coach-check-section p, .coach-product-reference p { margin:4px 0; white-space:pre-wrap; }
.coach-request-state { color:var(--green); font-size:11px; }
.coach-request-list [data-request-status="approval"] .coach-request-state, .coach-request-list [data-request-status="verify"] .coach-request-state { color:var(--warning); }
.coach-check-section { padding:7px 0; border-top:1px solid var(--line); }
.coach-check-section > strong { color:var(--ink); font-size:12px; }
.coach-check-section ul { padding-left:18px; margin:5px 0; }
.coach-grounded-fact { display:grid; grid-template-columns:minmax(65px,1fr) minmax(0,3fr); gap:2px 10px; margin:6px 0; }
.coach-grounded-fact p { color:var(--ink); margin:0; }
.coach-grounded-fact small { grid-column:2; }
.coach-product-reference article { padding:8px 0; border-bottom:1px solid var(--line); }
.coach-product-heading strong { color:var(--ink); }
.coach-product-heading .text-button { font-size:12px; padding:3px 0; }
.coach-reference-price { padding:6px 8px; background:var(--soft); border-radius:6px; }
.coach-reference-price > span { font-size:11px; color:var(--warning); }
.coach-product-assets { color:var(--ink); }
.coach-feedback { margin-top:4px; }
.coach-feedback > .text-button { font-size:12px; padding:3px 0; color:var(--muted); }
.coach-feedback-options { display:flex; flex-wrap:wrap; align-items:end; gap:6px; padding:7px 0; }
.coach-feedback-options[hidden] { display:none; }
.coach-feedback-options label { margin:0; min-width:0; }
.coach-feedback-options select { font-size:12px; padding:6px 9px; }
.coach-feedback-options button { font-size:12px; padding:6px 9px; }
.coach-feedback-options [role="status"] { width:100%; }
.library-rule-fields, .library-task-details { padding:10px 0; }
.library-rule-fields > summary, .library-task-details > summary { cursor:pointer; color:var(--green); font-weight:600; margin-bottom:10px; }
.library-rule-fields textarea { font-size:14px; }
.reply-review-required { border-left:2px solid var(--warning); padding-left:9px; }
.reply-example-ack { font-size:12px; margin:9px 0; color:var(--ink); }
.coach-evidence {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}
.coach-evidence summary {
  cursor: pointer;
}
.coach-evidence-item {
  border-left: 2px solid var(--line);
  padding: 5px 8px;
  margin-top: 6px;
}
.coach-evidence-item p {
  margin: 3px 0;
  color: var(--text);
  white-space: pre-wrap;
}
.coach-evidence-item small {
  display: block;
}
.coach-safety-review {
  background: #322d21;
  border: 1px solid #665537;
  border-radius: 7px;
  padding: 8px 10px;
  margin: 6px 0 3px;
  color: #ffda8a;
  font-size: 12px;
}
.coach-safety-review ul {
  padding-left: 18px;
  margin: 5px 0 8px;
}
.coach-review-preview {
  color: var(--text);
  padding-top: 6px;
  border-top: 1px solid #665537;
}
.coach-review-preview p {
  margin: 3px 0;
  white-space: pre-wrap;
}
.coach-review-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding-block: 6px;
}
.coach-review-actions button {
  min-height: 36px;
  font-size: 13px;
  padding: 6px 12px;
  margin: 0;
}
.coach-review-actions span {
  font-size: 12px;
  color: var(--muted);
}
.coach-context-form summary {
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
}
.coach-media-label,
.coach-media-observation small,
.coach-media-choice small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.coach-media-settings,
.coach-media-review {
  min-width: 0;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #19262d;
}
.coach-media-settings legend,
.coach-media-review summary {
  font-size: 12px;
  color: #a8d2f0;
}
.coach-media-review summary {
  cursor: pointer;
}
.coach-media-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.6;
}
.coach-media-choice input {
  width: auto;
  flex: 0 0 auto;
  margin-top: 5px;
}
.coach-media-choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.coach-media-observation {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}
.coach-media-observation p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.coach-condition-summary {
  background: #142532;
  color: #a8d2f0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}
.coach-fact-list {
  display: grid;
  gap: 8px;
  margin-block: 12px;
}
.coach-fact-list > div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 2px 10px;
  padding: 8px 10px;
  background: #1b2b35;
  border-radius: 6px;
}
.coach-fact-list strong {
  font-size: 12px;
}
.coach-fact-list span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.coach-fact-list small {
  grid-column: 2;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.coach-fact-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-bottom: 8px;
}
.coach-fact-row label {
  min-width: 0;
  font-size: 12px;
  margin: 0;
}
.coach-fact-row input,
.coach-fact-row select {
  font-size: 14px;
  padding: 8px;
}
.coach-fact-row button {
  padding: 8px 0;
}
.condition-goal {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 0;
}
.condition-goal > span {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text);
}
.condition-goal input {
  flex: 1;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.6;
  background: #19262d;
}
.scene-common summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
.scene-common label {
  margin-top: 10px;
}
#guidance-feedback[data-state="dirty"] {
  color: #ffda8a;
}
#guidance-feedback[data-state="error"] {
  color: #ffb0b5;
}
#guidance-feedback[data-state="saved"] {
  color: #a9e2c7;
}
@media (min-width: 721px) {
  #workspace .composer button.ai-tool {
    width: auto;
    min-width: 32px;
    padding-inline: 5px;
    gap: 4px;
  }
  #workspace .composer button.ai-tool span {
    display: inline;
    font-size: 12px;
    white-space: nowrap;
  }
}
@media (max-width: 720px) {
  .coach-comparison {
    grid-template-columns: 1fr;
  }
  .coach-panel .coach-details {
    max-height: min(34dvh, 260px);
  }
  .coach-fact-row {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .coach-fact-list > div {
    grid-template-columns: 1fr;
  }
  .coach-fact-list small {
    grid-column: 1;
  }
  #workspace .composer button.ai-tool {
    width: auto;
    padding-inline: 8px;
    gap: 4px;
  }
  #workspace .composer button.ai-tool span {
    display: inline;
    font-size: 12px;
    white-space: nowrap;
  }
  #workspace .tools-open .composer-toolbar {
    flex-wrap: wrap;
    max-width: calc(100vw - 28px);
  }
}

@media (min-width: 1101px) {
  #workspace div.composer {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #workspace .composer > #composer-tools {
    grid-column: 1 / -1;
    grid-row: 1;
    height: 32px;
  }
  #workspace .composer > #composer,
  #workspace .composer > #expression-toggle {
    grid-column: 1;
    grid-row: 2;
  }
  #workspace .composer #send-button {
    grid-column: 2;
    grid-row: 2;
  }
  #workspace .composer #composer-hint.important-hint {
    grid-row: 3;
  }
}

/* Dedicated AI guidance: scenario list and condition/reply worksheet. */
#dialog.guidance-dialog {
  width: 1120px;
  height: min(820px, 92dvh);
  max-height: 92dvh;
}
#dialog.guidance-dialog[open] {
  display: flex;
  flex-direction: column;
}
#dialog.guidance-dialog .dialog-header {
  flex-shrink: 0;
  padding: 16px 22px;
}
#dialog.guidance-dialog .dialog-header h2 {
  font-size: 20px;
}
#dialog.guidance-dialog #dialog-body {
  flex: 1;
  padding: 0;
  min-height: 0;
  overflow: hidden;
}

/* Customer orders: three table views. */
#dialog.orders-dialog {
  width: min(1240px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: 92dvh;
}
#dialog.orders-dialog[open] {
  display: flex;
  flex-direction: column;
}
#dialog.orders-dialog .dialog-header {
  flex-shrink: 0;
  padding: 20px 24px;
}
#dialog.orders-dialog #dialog-body {
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.order-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.order-workspace-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.order-view-tabs {
  display: flex;
  gap: 28px;
  flex-shrink: 0;
}
.order-view-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 17px 0 14px;
  font-size: 14px;
  font-weight: 600;
}
.order-view-tabs button[aria-selected="true"] {
  color: var(--green);
  border-bottom-color: var(--green);
}
#order-save-status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
#order-save-status.error {
  color: #f6a2a5;
}
#order-table-panel {
  min-height: 0;
  padding: 20px 24px 24px;
}
.order-table-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
}
.order-table-caption > span:first-child {
  font-weight: 600;
}
.order-table-caption small {
  margin-left: 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.order-table-caption > span:last-child {
  color: var(--muted);
  font-size: 12px;
}
.order-table-scroll {
  overflow: auto;
  max-height: calc(92dvh - 228px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.order-data-table {
  width: 100%;
  min-width: 940px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.order-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 13px 16px;
  background: #243645;
  font-size: 12px;
  font-weight: 600;
  color: #bed0db;
  border-bottom: 1px solid var(--line);
}
.order-data-table td {
  padding: 14px 16px;
  vertical-align: middle;
  border-right: 1px solid #2d414e;
  border-bottom: 1px solid #2d414e;
  overflow-wrap: anywhere;
}
.order-data-table td:last-child {
  border-right: 0;
}
.order-data-table tbody:last-child tr:last-child td {
  border-bottom: 0;
}
.order-data-table tbody:nth-of-type(even) {
  background: #1c2b36;
}
.order-data-table tbody:hover {
  background: #21323e;
}
.order-col-date {
  width: 128px;
}
.order-col-product {
  width: 116px;
}
.order-col-price {
  width: 252px;
}
.order-col-quantity {
  width: 86px;
}
.order-col-tracking {
  width: 218px;
}
.order-col-note {
  width: auto;
}
.order-col-photos {
  width: auto;
}
.order-col-upload {
  width: 160px;
}
.order-date-cell time {
  display: block;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.order-date-cell small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}
.order-mobile-field-label,
.order-mobile-delete {
  display: none;
}
.order-product-image,
.order-actual-image {
  display: block;
  width: 72px;
  height: 78px;
  object-fit: contain;
  background: #101a22;
  border-radius: 5px;
}
.order-price-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.order-price-input {
  display: flex;
  align-items: center;
  gap: 7px;
}
.order-price-input input {
  flex: 1;
}
.order-price-input select {
  width: 116px;
  flex: none;
  min-width: 0;
  margin: 0;
  padding: 9px 4px;
  font: inherit;
  background: #13222d;
  color: var(--text);
  border: 1px solid #3e596a;
  border-radius: 5px;
}
.order-actual-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 180px;
  min-width: 0;
}
.order-actual-video {
  width: 180px;
  height: 130px;
  object-fit: contain;
  background: #101a22;
  border-radius: 6px;
}
.order-actual-name {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-actual-card button {
  align-self: flex-start;
  padding: 4px 8px;
}
#order-export {
  flex: none;
  margin-left: auto;
}
.order-price-input span {
  flex: none;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.order-data-table input,
.order-data-table textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 9px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: #13222d;
  color: var(--text);
  font: inherit;
  box-shadow: none;
}
.order-data-table textarea {
  resize: vertical;
  min-height: 54px;
  line-height: 1.5;
}
.order-data-table input::placeholder,
.order-data-table textarea::placeholder {
  color: #7f949f;
}
.order-data-table input:hover,
.order-data-table textarea:hover {
  border-color: #3e596a;
}
.order-data-table input:focus,
.order-data-table textarea:focus {
  outline: none;
  border-color: var(--green);
  background: #10232a;
}
.order-data-table [aria-invalid="true"] {
  border-color: #f39b9f;
}
.order-quantity-cell input {
  text-align: center;
  padding: 9px 3px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.order-quantity-cell input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.order-note-value {
  white-space: pre-wrap;
  line-height: 1.6;
}
.order-table-muted {
  color: var(--muted);
  font-size: 12px;
}
.order-data-table .order-table-empty {
  padding: 64px 20px;
  text-align: center;
  color: var(--muted);
}
.order-photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 78px;
}
.order-photo-upload {
  position: relative;
  display: inline-flex;
  padding: 9px 12px;
  border: 1px solid #426251;
  border-radius: 5px;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
}
.order-photo-upload:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.order-photo-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
.order-photo-upload:has(input:disabled) {
  opacity: 0.5;
  pointer-events: none;
}
.order-row-menu {
  position: fixed;
  z-index: 1000;
  padding: 5px;
  width: 150px;
  background: #283d4b;
  border: 1px solid #486171;
  border-radius: 7px;
  box-shadow: 0 6px 24px #0006;
}
.order-row-menu button {
  width: 100%;
  text-align: left;
  padding: 10px;
  border: 0;
  border-radius: 4px;
  color: #f4b4b8;
  background: transparent;
}
.order-row-menu button:hover {
  background: #3b4a54;
}
@media (max-width: 720px) {
  #dialog.orders-dialog {
    width: 100%;
    max-width: 100%;
    height: 88dvh;
    max-height: 88dvh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #dialog.orders-dialog .dialog-header {
    padding: 12px 16px 8px;
  }
  #dialog.orders-dialog #dialog-body,
  .order-workspace,
  #order-table-panel {
    flex: 1;
    min-height: 0;
  }
  .order-workspace {
    height: 100%;
  }
  .order-workspace-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 16px 7px;
    flex: none;
  }
  .order-view-tabs {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .order-view-tabs button {
    padding: 11px 2px 9px;
    font-size: 13px;
  }
  #order-save-status {
    font-size: 11px;
    text-align: left;
    min-height: 0;
  }
  #order-table-panel {
    display: flex;
    flex-direction: column;
    padding: 8px 12px 12px;
  }
  .order-table-caption {
    flex: none;
    align-items: center;
    flex-direction: row;
    margin-bottom: 8px;
  }
  .order-table-caption > span:first-child {
    font-size: 0;
  }
  .order-table-caption small {
    margin-left: 0;
    font-size: 12px;
  }
  .order-table-caption > span:last-of-type {
    display: none;
  }
  .order-table-caption button {
    margin-left: auto;
    padding: 6px 10px;
  }
  .order-table-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    scrollbar-gutter: auto;
  }
  .order-data-table,
  .order-data-table tbody,
  .order-data-table tr,
  .order-data-table td {
    display: block;
  }
  .order-data-table {
    min-width: 0;
    border: 0;
    background: transparent;
  }
  .order-data-table colgroup,
  .order-data-table thead {
    display: none;
  }
  .order-data-table tbody {
    margin-bottom: 10px;
    border: 1px solid #365061;
    border-radius: 10px;
    background: #1c2b36;
    overflow: hidden;
  }
  .order-data-table tbody:nth-of-type(even) {
    background: #1c2b36;
  }
  .order-data-table tbody:hover {
    background: #1c2b36;
  }
  .order-data-table tr {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px 12px;
    padding: 11px;
  }
  .order-data-table tbody tr + tr {
    border-top: 1px solid #365061;
  }
  .order-data-table td,
  .order-data-table tbody:last-child tr:last-child td {
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .order-date-cell {
    grid-column: 1 / -1;
    color: #bed0db;
  }
  .order-card-date {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .order-date-cell time,
  .order-date-cell small {
    display: inline;
    margin: 0 6px 0 0;
  }
  .order-mobile-delete {
    display: inline-flex;
    padding: 5px 8px;
    border: 0;
    background: transparent;
    color: #f4b4b8;
    font-size: 12px;
  }
  .order-mobile-field-label {
    display: block;
    margin-bottom: 4px;
    color: #a9beca;
    font-size: 11px;
  }
  .order-product-cell {
    grid-column: 1;
    grid-row: 2 / span 2;
  }
  .order-product-image {
    width: 84px;
    height: 100px;
  }
  .order-price-cell {
    grid-column: 2;
    grid-row: 2;
  }
  .order-quantity-cell {
    grid-column: 2;
    grid-row: 3;
  }
  .order-quantity-cell input {
    width: 74px;
    text-align: left;
  }
  .order-price-input {
    gap: 4px;
  }
  .order-price-input select {
    width: clamp(82px, 26vw, 106px);
  }
  .order-tracking-cell,
  .order-note-cell {
    grid-column: 1 / -1;
  }
  .order-tracking-cell {
    border-top: 1px solid #365061 !important;
    padding-top: 8px !important;
  }
  .order-data-table textarea {
    min-height: 48px;
  }
  .order-data-table input,
  .order-data-table textarea {
    border-color: #365061;
  }
  .order-data-table tr:not(:first-child) .order-product-cell {
    grid-row: 1;
  }
  .order-data-table tr:not(:first-child) .order-quantity-cell {
    grid-row: 1;
  }
  .order-upload-table .order-product-cell {
    grid-column: 1;
    grid-row: 2;
  }
  .order-upload-table .order-upload-cell {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
  }
  .order-upload-cell button {
    width: 100%;
    min-height: 42px;
  }
  .order-upload-table .order-photos-cell {
    grid-column: 1 / -1;
    grid-row: 3;
    padding-top: 8px;
    border-top: 1px solid #365061;
  }
  .order-photo-strip {
    min-height: 0;
  }
  .order-data-table .order-table-empty {
    padding: 28px 14px;
  }
  .order-data-table tbody:has(.order-table-empty) tr {
    display: block;
  }
  .order-actual-card {
    flex: 1 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
  }
  .order-actual-video {
    width: 100%;
    height: 108px;
  }
  .order-table-scroll:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: -2px;
  }
  #dialog.orders-dialog #dialog-close {
    min-width: 44px;
    min-height: 44px;
  }
}
@media (max-width: 360px) {
  .order-data-table tr {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 7px 9px;
    padding: 9px;
  }
  .order-product-image {
    width: 72px;
    height: 92px;
  }
  .order-price-input select {
    width: 82px;
  }
}
.ai-guidance {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0;
}
.guidance-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.guidance-tabs button {
  padding: 8px 14px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 13px;
}
.guidance-tabs button[aria-pressed="true"] {
  background: #25443e;
  color: #9be5cd;
  border-color: #3e6a5d;
}
#reference-count {
  margin-left: 5px;
  font-size: 11px;
}
.ai-guidance [data-guidance-pane] {
  padding: 20px 24px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.ai-guidance [data-guidance-pane="general"]:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-guidance [data-guidance-pane="general"] > label {
  flex: 1;
  min-height: 220px;
}
.ai-guidance [data-guidance-pane="general"] > label > textarea {
  flex: 1;
  min-height: 0;
  resize: none;
  line-height: 1.65;
}
.ai-guidance [data-guidance-pane="general"] > .guidance-options,
.ai-guidance [data-guidance-pane="general"] > .helper {
  flex-shrink: 0;
}
.ai-guidance [data-guidance-pane="general"] > .helper {
  margin: 0;
}

.guidance-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.guidance-options .check-row {
  margin: 0;
}
.ai-guidance textarea {
  resize: vertical;
}
.ai-guidance .reference-workspace {
  padding: 0;
  overflow: hidden;
}
.reference-workspace:not([hidden]) {
  display: flex;
  flex-direction: column;
}
.reference-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.reference-browser {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #142029;
}
.reference-list-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 16px 10px;
  font-size: 12px;
  flex-shrink: 0;
}
.reference-list-heading span {
  color: var(--muted);
  font-size: 11px;
}
.reference-toolbar {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
  flex-shrink: 0;
}
.reference-toolbar .reference-search {
  margin: 0;
  min-width: 0;
}
.reference-search input {
  margin: 0;
  padding: 9px 10px;
  font-size: 12px;
}
.reference-toolbar button {
  padding: 9px 12px;
  font-size: 12px;
}
#reference-list {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 0 8px 12px;
}
.reference-item,
.condition-row {
  --card-border: #39505d;
  --card-surface: #1b2b35;
  --card-heading: #223744;
  --card-selected: #28404c;
  --card-accent: #dce5e9;
}
.reference-item {
  display: flex;
  gap: 8px;
  width: 100%;
  text-align: left;
  align-items: flex-start;
  padding: 12px 10px;
  margin: 2px 0;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-surface);
  color: var(--text);
}
.reference-item:hover {
  background: var(--card-heading);
}
.reference-item[aria-pressed="true"] {
  background: var(--card-selected);
  border-color: #7bb6c5;
}
.reference-number {
  font-size: 12px;
  color: var(--card-accent);
  min-width: 18px;
  padding-top: 3px;
}
.reference-item-content {
  min-width: 0;
  flex: 1;
}
.reference-item strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 500;
  color: var(--card-accent);
}
.reference-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.reference-list-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
}
#reference-editor {
  min-width: 0;
  overflow: auto;
  scrollbar-width: thin;
}
.scene-heading {
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.scene-heading-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.scene-heading-top button {
  font-size: 12px;
  padding: 0;
}
.scene-heading h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.scene-purpose {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.guidance-library-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0 0;
}
.reference-keywords {
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}
.reference-keywords summary {
  cursor: pointer;
}
.reference-keywords label {
  display: block;
  margin-top: 8px;
}
.reference-keywords input {
  margin: 6px 0 0;
  padding: 9px 10px;
  font-size: 14px;
}
.reference-editor-fields {
  display: grid;
  gap: 16px;
  padding: 18px 24px 24px;
}
.reference-editor-fields label {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
}
.reference-editor-fields .helper {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
#scene-information:not([hidden]) {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #142029;
}
#scene-information input,
#scene-information textarea {
  margin: 6px 0 0;
  font-size: 14px;
  padding: 10px;
}
.reply-variant-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.reply-variant-heading strong {
  font-size: 14px;
}
.reply-variant-heading button {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 12px;
}
#branch-list {
  display: grid;
  gap: 14px;
}
.condition-row {
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--card-border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--card-surface);
}
.condition-row:focus-within {
  border-color: #7bb6c5;
}
.condition-row-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--card-border);
  background: var(--card-heading);
}
.condition-number {
  font-size: 12px;
  color: var(--card-accent);
  flex-shrink: 0;
}
.condition-row-heading input {
  min-width: 0;
  flex: 1;
  width: 0;
  margin: 0;
  padding: 5px 6px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--card-accent);
}
.condition-row-heading input:hover {
  border-color: #455a63;
}
.condition-row-heading input:focus {
  background: #0f1c23;
  border-color: #6dbfa5;
}
.branch-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.branch-actions button {
  padding: 4px 0;
  font-size: 12px;
  color: var(--muted);
}
.branch-actions [data-branch-remove]:hover,
[data-reference-delete] {
  color: #e7a7a7;
}
.condition-pair {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  padding: 12px;
}
.condition-pair label {
  min-width: 0;
}
.condition-pair label > span {
  display: block;
  color: #a8d2f0;
  font-size: 12px;
  margin-bottom: 7px;
}
.condition-pair label:last-child > span {
  color: #a9e2c7;
}
.condition-pair textarea {
  display: block;
  width: 100%;
  margin: 0;
  min-height: 84px;
  padding: 10px;
  font-size: 14px;
  line-height: 1.6;
  background: #0f1b23;
  border-color: #32454f;
}
.condition-pair label:first-child textarea {
  color: #d8eafd;
  background: #142532;
}
.condition-pair label:last-child textarea {
  color: #bcefd6;
  background: #162d28;
  border-radius: 10px 10px 3px 10px;
}
.scene-common label {
  color: var(--text);
}
.scene-common {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.scene-common textarea {
  margin: 8px 0 0;
  padding: 10px;
  font-size: 14px;
  line-height: 1.6;
}
.scene-actions {
  display: flex;
  justify-content: flex-end;
}
.scene-actions button {
  padding: 0;
  font-size: 11px;
}
.guidance-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: #19262e;
}
.guidance-footer > div {
  min-width: 0;
}
.guidance-footer [role="status"] {
  display: block;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#reference-budget {
  display: block;
  font-size: 12px;
  color: #82969f;
  margin-top: 4px;
}
.guidance-footer .primary {
  flex-shrink: 0;
  padding: 10px 24px;
  font-size: 13px;
}
.guidance-empty {
  padding: 70px 24px;
  text-align: center;
  color: var(--muted);
}
.guidance-empty > span {
  font-size: 32px;
  color: #8bd8be;
}
.guidance-empty h3 {
  color: var(--text);
  font-size: 16px;
}
.guidance-empty p {
  font-size: 13px;
  line-height: 1.7;
}
#guidance-open {
  color: #c5b2ea;
}
@media (max-width: 720px) {
  #dialog.guidance-dialog {
    max-width: calc(100% - 16px);
    height: 94dvh;
    max-height: 94dvh;
    margin: auto;
    border-radius: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0;
  }
  #dialog.guidance-dialog .dialog-header {
    padding: 14px 16px;
  }
  #dialog.guidance-dialog .dialog-header h2 {
    font-size: 18px;
  }
  .guidance-tabs {
    padding: 8px 12px;
  }
  .guidance-tabs button {
    padding: 8px 12px;
  }
  .ai-guidance [data-guidance-pane] {
    padding: 16px;
  }
  .guidance-options {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ai-guidance .reference-workspace {
    padding: 0;
  }
  .reference-layout {
    display: flex;
  }
  .reference-browser {
    width: 100%;
    border-right: 0;
  }
  .reference-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #reference-editor {
    display: none;
    width: 100%;
  }
  .reference-layout.editing .reference-browser {
    display: none;
  }
  .reference-layout.editing #reference-editor {
    display: block;
  }
  .scene-heading {
    padding: 12px 14px;
  }
  .scene-heading h3 {
    font-size: 15px;
  }
  .reference-editor-fields {
    padding: 14px;
    gap: 14px;
  }
  .reply-variant-heading {
    align-items: flex-start;
  }
  .reply-variant-heading .helper {
    font-size: 12px;
    max-width: 175px;
  }
  .reply-variant-heading button {
    padding: 7px 9px;
  }
  .condition-pair {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .condition-pair textarea {
    min-height: 68px;
  }
  .condition-row-heading {
    padding: 8px 10px;
  }
  .guidance-footer {
    padding: 10px 14px;
    gap: 10px;
  }
  .guidance-footer .primary {
    padding: 10px 14px;
  }
}

/* Actual product videos open in the existing full-size player. */
.order-actual-card .order-actual-preview {
  position: relative;
  display: block;
  width: 180px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #101a22;
  cursor: zoom-in;
}
.order-actual-preview .order-actual-video {
  display: block;
  pointer-events: none;
}
.order-preview-label {
  position: absolute;
  inset: auto 0 0;
  padding: 10px 8px;
  background: linear-gradient(transparent, #000b);
  color: white;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.order-actual-preview:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
/* Shared product reference preview. */
.order-product-preview {
  display: inline-flex;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #101a22;
  cursor: zoom-in;
}
.order-product-preview:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
.order-product-preview .order-product-image {
  display: block;
  margin: 0;
}
#order-image-viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #0a1016;
  color: #f5f7fa;
  overflow: hidden;
}
#order-image-viewer[open] {
  display: flex;
  flex-direction: column;
}
.order-image-viewer header,
.order-image-viewer footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px
    max(16px, env(safe-area-inset-left));
  background: #18242e;
}
.order-image-viewer header strong {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.order-image-viewer button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #3d505e;
  background: #263b4a;
  color: white;
  border-radius: 8px;
}
.order-image-stage {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}
.order-image-stage img {
  /* Keep intrinsic image dimensions out of the stage's grid sizing. */
  position: absolute;
  inset: 0;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
.order-image-error {
  position: absolute;
  padding: 20px;
  background: #17242e;
}
.order-image-viewer footer {
  justify-content: center;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.order-image-counter {
  min-width: 56px;
  text-align: center;
}
/* Daily cross-customer order worksheet. */
#dialog.order-center-dialog {
  width: min(1560px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: 94dvh;
  max-height: 94dvh;
  padding: 0;
  overflow: hidden;
}
#dialog.order-center-dialog[open] {
  display: flex;
  flex-direction: column;
}
#dialog.order-center-dialog #dialog-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
}
#order-center {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.center-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
#center-status {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#center-status.error {
  color: #ed9c9c;
}
#center-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 16px 20px;
  gap: 12px;
  overflow: auto;
}
.center-filters,
.center-toolbar,
.center-actions,
.center-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.center-filter-panel,
.center-actions-extra,
.center-actions-extra-list {
  display: contents;
}
.center-filter-panel > summary,
.center-actions-extra > summary {
  display: none;
}
.center-filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 0;
}
#order-center input,
#order-center select,
#order-center textarea {
  margin: 0;
  min-width: 0;
  background: #14232d;
  color: var(--text);
  border: 1px solid #304957;
  border-radius: 6px;
  font-size: 13px;
  padding: 9px;
}
#order-center input[type="checkbox"],
.center-confirm-choice input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}
.center-filters input[type="date"] {
  width: 144px;
  color-scheme: dark;
}
.center-filters input[data-filter="q"] {
  width: 200px;
}
.center-toolbar {
  color: var(--muted);
  font-size: 12px;
}
.center-toolbar select {
  max-width: 285px;
}
.center-actions button,
.center-inline button,
.center-day button {
  font-size: 12px;
  padding: 9px 12px;
}
.center-actions .primary {
  background: #5dc8a8;
  color: #102c24;
}
.center-table-scroll {
  flex: 1;
  min-height: 170px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  overscroll-behavior: contain;
}
.center-table {
  width: 100%;
  min-width: 1140px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}
.center-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #233744;
}
.center-table th {
  color: #bdd1db;
  text-align: left;
  padding: 12px 10px;
}
.center-table td {
  vertical-align: middle;
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.center-table th:nth-child(1) {
  width: 40px;
}
.center-table th:nth-child(2) {
  width: 170px;
}
.center-table th:nth-child(3) {
  width: 100px;
}
.center-table th:nth-child(4) {
  width: 52px;
}
.center-table th:nth-child(5) {
  width: 290px;
}
.center-table th:nth-child(6) {
  width: 120px;
}
.center-table th:nth-child(7) {
  width: 158px;
}
.center-select-all {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  width: auto;
  margin: 0;
}
.center-select-all span {
  display: none;
}
.center-table .order-product-image {
  width: 76px;
  height: 96px;
  object-fit: contain;
}
.center-table code {
  display: block;
  font-size: 11px;
  color: #cbdbe3;
}
.center-customer {
  display: block;
  padding: 6px 0;
  text-align: left;
  font-size: 13px;
}
.center-table small {
  display: block;
  margin: 4px 0;
  color: var(--muted);
}
.center-table details {
  color: #a1b2bb;
  font-size: 11px;
  margin-top: 7px;
}
.center-table input:not([type="checkbox"]),
.center-table textarea {
  width: 100%;
}
.center-table td:last-child button {
  text-align: left;
  font-size: 12px;
  padding: 5px 0;
}
.center-day th {
  background: #1e303c;
  border-top: 1px solid var(--line);
  padding: 8px 12px;
}
.center-day th > div {
  display: flex;
  align-items: center;
  gap: 16px;
}
.center-day th > div > button:last-child {
  margin-left: auto;
}
.center-photo-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 0 6px;
}
.center-photo {
  flex: 0 0 84px;
}
.center-photo > button:first-child {
  display: block;
  width: 84px;
  padding: 0;
  position: relative;
  background: #0e1920;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
}
.center-photo img {
  display: block;
  width: 84px;
  height: 66px;
  object-fit: contain;
}
.center-photo span {
  display: block;
  color: #d3e2e8;
  font-size: 10px;
  padding: 3px;
}
.center-photo > .text-button {
  font-size: 11px;
  padding: 4px;
}
.center-inline {
  gap: 8px;
}
.center-inline .order-photo-upload {
  padding: 8px 10px;
  font-size: 12px;
}
.center-confirmed {
  color: #83d7b8;
}
.center-table td > [data-confirm] {
  display: block;
  font-size: 12px;
  padding: 8px 0;
}
.center-paste {
  display: block;
  font-size: 13px;
}
#order-center #tracking-paste {
  display: block;
  width: 100%;
  margin-top: 12px;
  line-height: 1.8;
  resize: vertical;
}
#tracking-rows {
  min-height: 0;
  overflow: auto;
}
.center-import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.center-import-table td,
.center-import-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
#tracking-save {
  margin-top: 12px;
}
.center-capture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.7fr);
  gap: 28px;
  min-height: 0;
  overflow: auto;
}
.capture-product {
  display: grid;
  place-items: center;
  background: #101b23;
  border-radius: 10px;
  min-height: 240px;
}
.capture-product .order-product-preview {
  width: 100%;
  height: 100%;
  max-height: 58dvh;
  justify-content: center;
}
.capture-product .order-product-image {
  width: 100%;
  height: 100%;
  max-height: 58dvh;
  object-fit: contain;
}
.capture-details h3 {
  margin: 8px 0;
}
.capture-details p {
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.capture-upload .order-photo-upload {
  display: inline-block;
  padding: 15px 24px;
  margin: 14px 0 0;
  font-size: 16px;
  background: #254f43;
}
.center-confirm-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.center-confirm-choice img {
  width: 64px;
  height: 72px;
  object-fit: contain;
}
.center-reply {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.center-reply small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}
#mobile-orders-center-open svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
@media (min-width: 721px) {
  #mobile-orders-center-open {
    display: none;
  }
}
@media (max-width: 720px) {
  #dialog.order-center-dialog {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #dialog.order-center-dialog .dialog-header {
    flex-shrink: 0;
    padding: max(32px, calc(env(safe-area-inset-top) + 8px)) 16px 12px;
  }
  #dialog.order-center-dialog #dialog-close {
    min-width: 44px;
    height: 44px;
    border: 1px solid #456071;
    background: #2b4352;
  }
  .center-heading {
    padding: 0 12px;
    gap: 6px;
  }
  .center-heading .order-view-tabs button {
    padding: 13px 10px;
    font-size: 14px;
  }
  #center-status {
    max-width: 48%;
    font-size: 11px;
  }
  #center-content {
    padding: 12px;
    gap: 10px;
  }
  .center-filter-panel {
    display: block;
  }
  .center-filter-panel > summary,
  .center-actions-extra > summary {
    display: block;
    list-style: none;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #233744;
    color: #d3e2e8;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
  }
  .center-filter-panel > summary::-webkit-details-marker,
  .center-actions-extra > summary::-webkit-details-marker {
    display: none;
  }
  .center-filter-panel > summary::after,
  .center-actions-extra > summary::after {
    content: "⌄";
    float: right;
  }
  .center-filter-panel[open] > summary::after,
  .center-actions-extra[open] > summary::after {
    content: "⌃";
  }
  .center-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding-top: 10px;
  }
  .center-filters label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    min-width: 0;
  }
  .center-filters input[type="date"],
  .center-filters input[data-filter="q"],
  .center-filters select {
    width: 100%;
    max-width: 100%;
  }
  .center-filters #center-search,
  .center-filters #center-reset {
    min-height: 40px;
  }
  .center-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  #order-center .center-toolbar select {
    width: 100%;
    max-width: 100%;
  }
  .center-toolbar #center-selection {
    text-align: right;
  }
  .center-toolbar #center-clear-selection {
    justify-self: end;
  }
  .center-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    flex-shrink: 0;
    padding: 0;
  }
  .center-actions > #center-capture {
    width: 100%;
  }
  .center-actions-extra {
    display: block;
    min-width: 0;
  }
  .center-actions-extra[open] {
    grid-column: 1 / -1;
  }
  .center-actions-extra-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 8px;
  }
  .center-actions button {
    min-height: 40px;
    white-space: normal;
    line-height: 1.25;
  }
  .center-table-scroll {
    min-height: 190px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
  }
  .center-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
  }
  .center-table thead,
  .center-table tbody {
    display: block;
  }
  .center-table tbody {
    width: 100%;
  }
  .center-table thead {
    position: static;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
  .center-table thead tr {
    display: block;
  }
  .center-table thead th {
    display: none;
  }
  .center-table thead th:first-child {
    display: block;
    width: 100%;
    padding: 9px 12px;
  }
  .center-select-all {
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
  }
  .center-select-all span {
    display: inline;
  }
  .center-day {
    display: block;
    width: 100%;
    margin: 12px 0 8px;
  }
  .center-table .center-day th {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 0;
    border-radius: 8px;
  }
  .center-day th > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
  }
  .center-day th > div > button:first-child {
    grid-column: 1 / -1;
  }
  .center-day th > div > button:last-child {
    margin-left: 0;
  }
  .center-table tr[data-center-row] {
    display: grid;
    grid-template-columns: 26px 76px minmax(0, 1fr);
    gap: 0 10px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #1e303c;
  }
  .center-table tr[data-center-row][hidden] {
    display: none;
  }
  .center-table tr[data-center-row] td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .center-table tr[data-center-row] td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    padding-top: 3px;
  }
  .center-table tr[data-center-row] td:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
  }
  .center-table tr[data-center-row] td:nth-child(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .center-table tr[data-center-row] td:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
    align-self: end;
    color: #c7d7e0;
  }
  .center-table tr[data-center-row] td:nth-child(4)::before {
    content: "数量 · ";
    color: var(--muted);
    font-size: 12px;
  }
  .center-table tr[data-center-row] td:nth-child(n + 5) {
    grid-column: 1 / -1;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--line);
  }
  .center-table tr[data-center-row] td:nth-child(n + 5)::before {
    display: block;
    margin-bottom: 7px;
    color: #bdd1db;
    font-size: 12px;
    font-weight: 700;
  }
  .center-table tr[data-center-row] td:nth-child(5)::before {
    content: "实拍";
  }
  .center-table tr[data-center-row] td:nth-child(6)::before {
    content: "客户确认";
  }
  .center-table tr[data-center-row] td:nth-child(7)::before {
    content: "物流单号";
  }
  .center-table tr[data-center-row] td:nth-child(8)::before {
    content: "备注 / 缺货";
  }
  .center-table .order-product-image {
    width: 76px;
    height: 96px;
  }
  .center-table .center-customer {
    padding: 3px 0;
  }
  .center-table .center-photo-strip {
    max-width: 100%;
  }
  .center-table tbody tr:not([data-center-row]):not(.center-day) {
    display: block;
  }
  .center-table tbody tr:not([data-center-row]):not(.center-day) td {
    display: block;
  }
  .center-capture {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .capture-product {
    min-height: 180px;
  }
  .capture-product .order-product-preview,
  .capture-product .order-product-image {
    max-height: 36dvh;
    min-height: 180px;
  }
  .capture-details h3 {
    font-size: 17px;
    margin: 0 0 5px;
  }
  .capture-details p {
    margin: 7px 0;
    font-size: 13px;
  }
  .capture-details .helper {
    font-size: 11px;
  }
  .capture-upload .order-photo-upload {
    display: block;
    text-align: center;
    width: 100%;
    margin-top: 5px;
  }
  .order-image-viewer header,
  .order-image-viewer footer {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .order-image-viewer footer {
    gap: 3px;
  }
  .order-image-counter {
    min-width: 40px;
  }
  .center-import-table {
    min-width: 570px;
  }
}
.center-drop-target {
  outline: 2px solid var(--green);
  outline-offset: -3px;
  background: #25443a;
}
.provider-account-fields:not([hidden]) {
  display: contents;
}
.provider-account-fields[hidden] {
  display: none;
}
.provider-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}
.meta-template-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0;
  padding: 12px;
  border-left: 3px solid var(--green);
  background: #172b26;
}
@media (max-width: 720px) {
  .center-heading {
    min-height: 56px;
    flex-shrink: 0;
  }
  .center-heading .order-view-tabs {
    flex: 0 0 auto;
    width: auto;
    max-width: 60%;
  }
  #center-status {
    flex: 1;
    min-width: 0;
    max-height: 40px;
    overflow: auto;
    text-align: right;
  }
}

.message-window-tools {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 10px 0;
}
[data-window-spacer] {
  pointer-events: none;
  overflow-anchor: none;
}

.model-provider-fields {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}
.model-provider-fields [hidden] {
  display: none !important;
}

#conversation-products {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 18px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.conversation-products-card > summary,
.product-chat-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  cursor: pointer;
  list-style: none;
}
.conversation-products-card > summary::after,
.product-chat-placeholder::after {
  content: "⌄";
  color: var(--muted);
}
.conversation-products-card[open] > summary::after {
  content: "⌃";
}
.product-chat-summary {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.product-chat-summary > span,
.product-chat-count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.product-chat-summary strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-chat-count {
  margin-left: auto;
}
.product-chat-placeholder {
  width: 100%;
  text-align: start;
}
.product-chat-placeholder:disabled {
  cursor: default;
  opacity: 1;
}
@media (max-width: 720px) {
  #conversation-products {
    padding: 0 12px;
  }
  .product-chat-summary {
    display: grid;
    gap: 3px;
  }
  .product-chat-count {
    display: none;
  }
}

.staff-module-choices{margin:0;min-width:0;padding:.85rem 1rem;border:1px solid var(--border,#465565);border-radius:10px}
.staff-module-choices legend{font-weight:700;padding:0 .3rem}
.staff-module-grid,.staff-home-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));gap:.45rem .85rem}
.staff-module-grid .check-row{margin:0;padding:.25rem 0}
.staff-module-choices p{margin:.6rem 0 0}
.workspace.modules-home .inbox,.workspace.modules-home .chat-area{display:none!important}
.staff-home:not([hidden]){grid-column:2/-1;display:grid;align-content:center;justify-items:center;padding:1.5rem;overflow:auto;min-width:0}
.staff-home>div{width:min(100%,32rem)}.staff-home h1{margin:0}.staff-home p{color:var(--muted);margin:.6rem 0 1.2rem}
.staff-home-actions{margin-bottom:1rem}.staff-home-actions:empty{display:none}
#customer-export[data-readonly] :is(.customer-export-toolbar,.customer-export-actions,th:first-child,td:first-child){display:none}
@media(max-width:760px){.staff-home:not([hidden]){grid-column:1/-1}}

[data-mobile-view][hidden],.staff-home[hidden]{display:none!important}

.staff-module-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:560px){.staff-module-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.model-execution { max-width: 100%; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; word-break: normal; color: var(--muted); margin-top: 5px; }
.model-execution[data-fallback="true"] { color: var(--accent); }
.model-execution[data-status="failed"] { color: var(--danger, #ef9292); }

/* Staff code login and WhatsApp account binding, shared by desktop and mobile. */
#admin-login-fields { display: grid; gap: 18px; }
#admin-login-fields.hidden { display: none; }
.login-story { position: relative; z-index: 1; margin: 64px 0; }
.login-mode-switch { display: inline-block; margin-top: 18px; color: var(--muted); font-size: 13px; }
.login-code-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 20px; }
.login-code-toolbar h3 { margin: 0 0 8px; }
.login-code-toolbar .card-actions { flex-wrap: wrap; }
.login-code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.login-code-row { margin: 0; min-width: 0; }
.login-code-row h3 { overflow-wrap: anywhere; }
.login-code-details { display: grid; gap: 12px; margin: 18px 0; }
.login-code-details > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.login-code-details dt { color: var(--muted); font-size: 12px; }
.login-code-details dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.login-code-suffix { font-family: monospace; letter-spacing: 2px; }
.staff-account-tag { display: inline-block; padding: 3px 8px; margin: 0 6px 6px 0; border: 1px solid var(--line); border-radius: 6px; }
.login-code-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.staff-account-choices { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.staff-account-choices .check-row span { overflow-wrap: anywhere; min-width: 0; }
.login-code-form input[type="datetime-local"] { width: 100%; min-width: 0; }
.login-code-form #staff-expiry-clear { justify-self: start; margin-top: -12px; }
.login-code-result .card-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
@media (max-width: 1000px) { .login-code-list { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 540px) {
  .login-code-toolbar .card-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .login-code-toolbar button { padding: 10px 8px; font-size: 12px; }
  .login-code-details > div { grid-template-columns: 112px minmax(0, 1fr); }
  .login-code-result .card-actions > button { flex: 1; }
}

/* Explicit product selection and human-reviewed drafts. */
.product-manager-filters{display:grid;grid-template-columns:1fr;gap:8px;padding:12px 14px;border-bottom:1px solid var(--line,#ddd)}
.product-manager-filters label{display:grid;gap:4px;font-size:12px;color:var(--muted,#67757c)}
.product-manager-filters select{width:100%;min-width:0}
.product-picker{margin-top:14px;padding:14px;border:1px solid var(--line,#d9e1df);border-radius:12px;background:var(--soft,#18232e);min-width:0}
.product-picker-heading,.product-picker-selection,.product-picker-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.product-picker-heading{justify-content:space-between}.product-picker-heading strong{overflow-wrap:anywhere;min-width:0}
.product-picker-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:10px;margin:10px 0}
.product-picker-image{min-width:0;border:1px solid var(--line,#ddd);border-radius:8px;padding:5px;display:grid;gap:5px}
.product-picker-image>button:first-child{padding:0;border:0;background:transparent;width:100%}
.product-picker-image img{display:block;width:100%;height:110px;object-fit:contain;background:#f3f6f5;border-radius:5px}
.product-picker-image label{display:flex;align-items:flex-start;gap:5px;font-size:12px;overflow-wrap:anywhere}
.product-picker-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:12px 0}
.product-picker-fields label{display:grid;gap:5px;font-size:12px;min-width:0}.product-picker-fields input{width:100%;min-width:0}
.product-picker-price{font-weight:600;overflow-wrap:anywhere}.product-sourcing-links{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0}
.product-sourcing-links small{color:var(--muted,#67757c)}
.source-search-candidate .product-picker{padding:10px}.source-search-candidate .product-picker-gallery{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:420px){.product-picker{padding:10px}.product-picker-fields{grid-template-columns:minmax(0,1fr)}.product-picker-actions button{flex:1 1 140px}.product-picker-selection{font-size:12px}}

.batch-review-inquiry-images{display:flex;gap:8px;overflow-x:auto;margin-top:8px}.batch-review-inquiry-images img{width:100px;height:100px;object-fit:contain;background:var(--soft);border:1px solid var(--line);border-radius:8px;flex:none}.sales-gallery[hidden]{display:none}
.product-picker .product-picker-image label{display:flex;align-items:flex-start;gap:6px;font-size:12px;font-weight:400}.product-picker input[type="checkbox"]{width:17px;height:17px;flex:0 0 17px}
/* Product previews float above the current tool, including on phones that use bottom sheets. */
dialog:is(.catalog-preview, .product-image-preview) {
  --preview-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  position: fixed;
  inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  margin: auto;
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 16px);
  max-height: var(--preview-height);
}
.catalog-preview {
  width: 720px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--text);
}
.catalog-preview[open] { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; overflow: hidden; }
.catalog-preview-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.catalog-preview-toolbar button { min-height: 44px; padding: 5px 9px; font-size: 12px; white-space: nowrap; }
.catalog-preview-toolbar [data-position] { margin-right: auto; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.catalog-preview :is(img,video) {
  display: block;
  max-width: 100%;
  max-height: calc(var(--preview-height) - 104px);
  object-fit: contain;
  margin: auto;
}
.catalog-preview [data-source] { color: var(--muted); text-align: center; }
dialog:is(.catalog-preview, .product-image-preview) [data-preview-stage] {
  position: relative;
  min-height: 0;
  flex: none;
}
dialog:is(.catalog-preview, .product-image-preview) [data-preview-viewport] {
  display: flex;
  align-items: center;
  justify-content: center;
  height: min(72dvh, calc(var(--preview-height) - var(--preview-stage-reserve, 112px)));
  overflow: hidden;
  overscroll-behavior: contain;
}
dialog:is(.catalog-preview, .product-image-preview) [data-preview-viewport] :is(img, video) {
  flex: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: 0;
}
dialog:is(.catalog-preview, .product-image-preview) [data-preview-viewport]:has(img) {
  touch-action: none;
  user-select: none;
}
dialog:is(.catalog-preview, .product-image-preview) [data-zoomed="true"] { cursor: grab; }
dialog:is(.catalog-preview, .product-image-preview) [data-zoomed="true"][data-dragging="true"] { cursor: grabbing; }
dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow {
  position: absolute;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 56px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #ffffff4d;
  border-radius: 12px;
  background: #10212dd9;
  color: #fff;
  font-size: 38px;
  line-height: 1;
  box-shadow: 0 2px 8px #0004;
  touch-action: manipulation;
}
dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow:is([data-back], [data-preview-previous]) { left: 8px; }
dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow:is([data-next], [data-preview-next]) { right: 8px; }
dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow:disabled { opacity: 0.3; cursor: default; }
dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
@media(max-width:420px) {
  dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow { width: 40px; height: 48px; }
  dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow:is([data-back], [data-preview-previous]) { left: 4px; }
  dialog:is(.catalog-preview, .product-image-preview) .preview-side-arrow:is([data-next], [data-preview-next]) { right: 4px; }
}
.product-picker{padding:14px;background:var(--panel);border-radius:12px;max-width:100%}
.product-picker-heading{align-items:flex-start;margin-bottom:4px}.product-picker-heading>div{display:grid;gap:5px;min-width:0}.product-picker-heading strong{font-size:15px}.product-picker-source-price{display:flex;gap:9px;align-items:baseline;font-size:12px;color:var(--muted)}.product-picker-source-price b{font-size:21px;color:var(--text);font-variant-numeric:tabular-nums}.product-picker-source-link{font-size:12px;color:var(--green)}
.product-picker-selection{padding:9px 0;margin:4px 0 0;border-bottom:1px solid var(--line);font-size:12px}.product-picker-selection button{min-height:36px;padding:5px 8px}.product-picker-selection span{margin-left:auto;color:var(--muted)}
.product-picker-gallery{grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:12px;margin:12px 0}.product-picker-image{position:relative;display:block;padding:0;overflow:hidden;border-radius:10px;background:var(--soft);border:2px solid transparent}.product-picker-image[data-selected="true"]{border-color:var(--green);box-shadow:0 0 0 1px var(--green)}
.product-picker-image>button:first-child{display:block}.product-picker-image img{height:180px;border-radius:8px;object-fit:contain;background:var(--soft)}.product-picker .product-picker-image label{position:absolute;top:7px;left:7px;align-items:center;gap:6px;margin:0;padding:5px 7px;border-radius:7px;background:#11252de0;color:#fff;cursor:pointer;min-height:32px;font-size:11px}.product-picker input[type="checkbox"]{margin:0;accent-color:var(--green);width:19px;height:19px;flex-basis:19px}.product-picker-move{position:absolute;bottom:7px;right:7px;min-height:30px;padding:3px 8px;background:var(--panel);font-size:11px}
.product-picker-footer{position:sticky;bottom:-20px;z-index:2;background:var(--panel);border-top:1px solid var(--line);padding:12px 0 4px}.product-picker-actions{margin:0;gap:8px}.product-picker-actions>.primary{flex:1;min-height:44px}.product-picker-hint{margin:6px 0!important;font-size:11px!important;color:var(--muted)}.product-picker [data-picker-status]{margin:6px 0 0;font-size:12px}.product-picker [data-picker-status]:empty{display:none}.source-search-candidate .product-picker{margin:0;padding:12px}.source-search-candidate .product-picker-gallery{grid-template-columns:repeat(auto-fill,minmax(145px,1fr))}
@media(max-width:720px){.product-picker{padding:10px}.product-picker-gallery,.source-search-candidate .product-picker-gallery{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.product-picker-image img{height:155px}.product-picker-heading strong{font-size:13px}.product-picker-heading>button{font-size:12px;padding:5px 7px}.product-picker-footer{bottom:-14px}.product-picker-actions>.primary{flex-basis:100%}}

/* Selection scrolls independently so its attachment action stays in view. */
.product-picker { display: flex; flex-direction: column; max-height: calc(100dvh - 140px); overflow: hidden; box-sizing: border-box; }
.product-picker-heading,.product-picker-selection,.product-picker-footer,.product-picker-info { flex: none; }
.product-picker-gallery { flex: 1; min-height: 0; overflow: auto; align-content: start; grid-auto-rows: max-content; overscroll-behavior: contain; }
.product-picker-gallery .product-picker-image > button:first-child { height: 180px; }
.product-picker-gallery .product-picker-image img { height: 100%; }
.product-picker .product-picker-image { flex: none; }
.product-picker .product-picker-image label { min-height: 36px; }
.product-picker-footer { position: static; }
.product-picker-info { max-height: 180px; overflow: auto; font-size: 12px; }
.product-picker-info > summary { padding: 7px 0; min-height: 28px; color: var(--muted); cursor: pointer; box-sizing: border-box; }
.product-source-records { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.product-source-records h4 { margin: 0 0 10px; font-size: 13px; }
.product-source-records article + article { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.product-source-records article > div { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: space-between; align-items: baseline; }
.product-source-records strong { font-size: 15px; }
.product-source-records a { font-size: 12px; color: var(--green); }
.product-source-records dl { margin: 10px 0 0; display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 6px 10px; font-size: 12px; }
.product-source-records dl:empty { display: none; }
.product-source-records dt { color: var(--muted); }
.product-source-records dd { margin: 0; overflow-wrap: anywhere; }
@media(max-width:720px) {
  .product-picker { max-height: calc(100dvh - 115px); }
  .product-picker-gallery { margin: 8px 0; }
  .product-picker-gallery .product-picker-image > button:first-child { height: 155px; }
  .product-picker-heading strong { font-size: 14px; }
  .product-picker-source-price b { font-size: 21px; }
  .product-picker-selection { padding: 5px 0; }
  .product-picker-footer { padding-top: 9px; }
  .product-picker-hint { font-size: 10px !important; }
}
