.catalog-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.catalog-overview article {
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 10px 32px rgba(28, 47, 37, .04);
}

.catalog-overview span,
.catalog-overview small { color: var(--muted); font-size: 11px; }
.catalog-overview strong { display: block; margin: 8px 0 5px; font-size: 25px; }
.catalog-warning { margin: 0 0 14px; padding: 11px 14px; border-radius: 10px; color: #98601b; background: #fff7e8; font-size: 12px; }
.catalog-toolbar { align-items: stretch; }
.catalog-search-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex: 1; }
.catalog-search-actions select,
.catalog-editor-form select {
  height: 42px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #415048;
  background: white;
}
.catalog-search-actions .search-box { width: min(100%, 300px); }
.catalog-search-actions > button { min-height: 42px; padding: 0 13px; white-space: nowrap; }
.catalog-create { padding: 0 15px !important; }
.catalog-table th:nth-child(1) { width: 23%; }
.catalog-table th:nth-child(2) { width: 17%; }
.catalog-table th:nth-child(3) { width: 11%; }
.catalog-table th:nth-child(4) { width: 12%; }
.catalog-table th:nth-child(5) { width: 11%; }
.catalog-table th:nth-child(6) { width: 26%; }
.catalog-name-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.catalog-name-cell > img,
.catalog-name-cell > span {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: #edf4ef;
}
.catalog-name-cell > span { display: grid; place-items: center; color: var(--green-700); font-weight: 800; }
.catalog-name-cell > div { min-width: 0; }
.catalog-name-cell strong,
.catalog-name-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-name-cell strong { color: var(--ink); font-size: 13px; }
.catalog-name-cell small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.catalog-actions { flex-wrap: wrap; }

.catalog-editor-dialog {
  width: min(880px, calc(100vw - 56px));
  max-height: calc(100vh - 50px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 19px;
  color: var(--ink);
  background: white;
  box-shadow: 0 32px 100px rgba(12, 29, 19, .3);
}
.catalog-editor-dialog::backdrop { background: rgba(11, 28, 18, .55); backdrop-filter: blur(3px); }
.catalog-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 25px;
  border-bottom: 1px solid var(--line);
}
.catalog-editor-header span { color: var(--green-700); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.catalog-editor-header h2 { margin: 5px 0 0; font-size: 21px; }
.catalog-editor-header > button { width: 35px; height: 35px; border: 0; border-radius: 9px; color: #728078; background: #f1f5f2; font-size: 22px; cursor: pointer; }
.catalog-editor-form { display: flex; max-height: calc(100vh - 145px); flex-direction: column; }
.catalog-editor-body { flex: 1; overflow: auto; padding: 8px 25px 28px; }
.editor-section { padding: 20px 0 5px; border-bottom: 1px solid #edf1ef; }
.editor-section:last-child { border-bottom: 0; }
.editor-section h3 { margin: 0 0 15px; font-size: 15px; }
.editor-tip { margin: -7px 0 12px; color: var(--muted); font-size: 11px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.editor-grid .wide { grid-column: 1 / -1; }
.editor-grid label,
.editor-section > label { display: grid; gap: 7px; color: #526159; font-size: 11px; font-weight: 700; }
.catalog-editor-form input:not([type="checkbox"]):not([type="file"]),
.catalog-editor-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: white;
  resize: vertical;
}
.editor-grid label > small { display: block; margin-top: 6px; color: #78847c; font-size: 11px; line-height: 1.45; }
.catalog-editor-form input:focus,
.catalog-editor-form textarea:focus,
.catalog-editor-form select:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(25, 163, 99, .08); }
.check-label { display: flex !important; min-height: 42px; align-items: center; grid-template-columns: auto 1fr; gap: 9px !important; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.check-label input { width: 16px; height: 16px; accent-color: var(--green-500); }
.check-label.disabled { opacity: .55; }
.image-field { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
.image-field input[type="file"] { display: none; }
.image-field button { border: 1px solid #bde3cf; border-radius: 10px; color: var(--green-700); background: var(--green-100); font-size: 11px; font-weight: 800; cursor: pointer; }
.image-field button:disabled { opacity: .6; cursor: wait; }
.image-preview { min-height: 92px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px dashed #cedad3; border-radius: 11px; color: #8b9790; background: #fafcfb; font-size: 11px; }
.image-preview img { max-width: 100%; max-height: 160px; object-fit: contain; }
.catalog-editor-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 24px; border-top: 1px solid var(--line); background: #fafcfb; }
.catalog-editor-footer button { min-width: 105px; padding: 0 17px; }
.editor-loading { display: grid; min-height: 260px; place-items: center; color: var(--muted); font-size: 13px; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 门店商品编辑器 */
.catalog-editor-dialog.product-editor-dialog-wide { width: min(1120px, calc(100vw - 48px)); }
.product-editor-dialog-wide .catalog-editor-header { padding: 17px 24px; }
.product-editor-form { min-height: min(720px, calc(100vh - 145px)); overflow: hidden; }
.product-editor-workspace {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: #f7faf8;
}
.product-editor-rail {
  display: flex;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
  gap: 5px;
  padding: 23px 14px 18px;
  border-right: 1px solid #e3ebe6;
  background: #f5f8f6;
}
.product-editor-rail > strong { margin: 0 9px 10px; color: #617067; font-size: 10px; letter-spacing: .08em; }
.product-editor-rail button {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 9px;
  border: 0;
  border-radius: 10px;
  color: #5e6c64;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.product-editor-rail button:hover { background: #edf3ef; }
.product-editor-rail button.active { color: var(--green-700); background: #e1f3e9; }
.product-editor-rail button > i {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 8px;
  color: #74827a;
  background: #e9efeb;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}
.product-editor-rail button.active > i { color: white; background: var(--green-500); }
.product-editor-rail button > span,
.product-editor-rail button small { display: block; }
.product-editor-rail button > span { min-width: 0; font-size: 12px; font-weight: 800; }
.product-editor-rail button small { margin-top: 3px; color: #8a968f; font-size: 9px; font-weight: 500; }
.product-editor-rail > p { margin: auto 9px 0; color: #89958e; font-size: 9px; line-height: 1.65; }
.product-editor-body { min-height: 0; padding: 20px 24px 34px; scroll-behavior: smooth; scroll-padding-top: 18px; }
.product-editor-section {
  margin-bottom: 15px;
  padding: 22px;
  border: 1px solid #e2eae5;
  border-radius: 15px;
  background: white;
  box-shadow: 0 8px 24px rgba(30, 61, 43, .035);
}
.product-editor-section:last-child { margin-bottom: 0; border-bottom: 1px solid #e2eae5; }
.product-editor-section > header { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.product-editor-section > header > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--green-700);
  background: var(--green-100);
  font-size: 10px;
  font-weight: 900;
}
.product-editor-section > header > div { min-width: 0; }
.product-editor-section > header h3 { margin: 0; color: var(--ink); font-size: 15px; }
.product-editor-section > header p { margin: 4px 0 0; color: #89958e; font-size: 10px; line-height: 1.45; }
.product-editor-section .editor-grid { gap: 16px; }
.product-editor-section select { width: 100%; }
.product-editor-section label > small { color: #89958e; font-size: 10px; font-weight: 500; line-height: 1.5; }

.product-media-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; }
.product-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.product-field-heading strong { color: #526159; font-size: 11px; }
.product-field-heading > span { color: #8a968f; font-size: 9px; }
.product-field-heading b { color: var(--green-700); }
.product-main-drop {
  position: relative;
  display: flex;
  height: 220px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  border: 1.5px dashed #bfd2c7;
  border-radius: 14px;
  outline: 0;
  color: #6d7d74;
  background: linear-gradient(145deg, #fbfdfc, #f2f7f4);
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.product-main-drop:hover,
.product-main-drop:focus-visible,
.product-main-drop.is-dragging { border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(25, 163, 99, .09); }
.product-main-drop.is-dragging { transform: scale(.99); }
.product-main-drop > i { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: white; background: var(--green-500); font-size: 23px; font-style: normal; }
.product-main-drop > strong { margin-top: 4px; color: #35483d; font-size: 12px; }
.product-main-drop > span { font-size: 10px; }
.product-main-drop > small { max-width: 170px; color: #98a39d; font-size: 9px; line-height: 1.45; text-align: center; }
.product-main-drop.has-image { border-style: solid; background: #edf3ef; }
.product-main-drop img { width: 100%; height: 100%; object-fit: cover; }
.product-image-change { position: absolute; right: 0; bottom: 0; left: 0; padding: 10px; color: white !important; background: linear-gradient(transparent, rgba(7, 24, 14, .72)); text-align: center; }
.product-main-drop.is-uploading::after,
.product-detail-gallery.is-uploading::after {
  content: '图片上传中…';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 3;
  color: white;
  background: rgba(14, 51, 31, .74);
  font-size: 11px;
  font-weight: 800;
}
.product-media-actions { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 8px; }
.product-media-actions button,
.product-spec-add {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #b7ddc9;
  border-radius: 9px;
  color: var(--green-700);
  background: var(--green-100);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.product-media-actions button.muted { color: #68776e; border-color: #d9e1dc; background: white; }
.product-media-actions button:disabled { opacity: .6; cursor: wait; }
.product-detail-media { min-width: 0; }
.product-detail-gallery {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(98px, 1fr));
  gap: 10px;
  min-height: 118px;
}
.product-detail-image { position: relative; min-width: 0; margin: 0; overflow: hidden; border: 1px solid #dce5df; border-radius: 12px; background: #f4f7f5; }
.product-detail-image img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.product-detail-image button { position: absolute; top: 6px; right: 6px; display: grid; width: 23px; height: 23px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: white; background: rgba(23, 41, 30, .76); cursor: pointer; }
.product-detail-image figcaption { padding: 7px 8px; overflow: hidden; color: #7b8880; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.product-detail-add { display: flex; min-height: 118px; align-items: center; justify-content: center; flex-direction: column; gap: 5px; border: 1.5px dashed #c9d8cf; border-radius: 12px; color: #78877e; background: #fbfdfc; cursor: pointer; }
.product-detail-add:hover { color: var(--green-700); border-color: var(--green-500); background: #f3fbf7; }
.product-detail-add i { font-size: 22px; font-style: normal; }
.product-detail-add strong { font-size: 10px; }
.product-detail-add span { color: #9aa69f; font-size: 8px; }
.product-detail-media > p { margin: 9px 0 0; color: #98a39d; font-size: 9px; line-height: 1.55; }
.product-intro-field { position: relative; display: grid; gap: 7px; margin-top: 18px; color: #526159; font-size: 11px; font-weight: 700; }
.product-intro-field > small { position: absolute; right: 11px; bottom: 9px; padding: 2px 5px; border-radius: 5px; background: rgba(255, 255, 255, .9); }

.product-spec-add { margin-left: auto; white-space: nowrap; }
.product-spec-table { overflow-x: auto; border: 1px solid #e0e8e3; border-radius: 12px; }
.product-spec-head,
.product-spec-row { display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(125px, 1fr) minmax(125px, 1fr) 74px 31px; align-items: center; gap: 9px; min-width: 650px; }
.product-spec-head { padding: 9px 11px; color: #7e8b83; background: #f5f8f6; font-size: 9px; font-weight: 800; }
.product-spec-row { padding: 9px 11px; border-top: 1px solid #edf1ef; }
.product-spec-row:first-child { border-top: 0; }
.product-spec-row label { display: block; }
.product-spec-row input { min-height: 38px !important; }
.money-field { position: relative; }
.money-field > i { position: absolute; top: 50%; left: 11px; z-index: 1; color: #839087; font-size: 11px; font-style: normal; transform: translateY(-50%); }
.money-field > input { padding-left: 28px !important; }
.product-spec-margin { justify-self: center; color: #8a968f; font-size: 10px; font-weight: 800; }
.product-spec-margin.positive { color: var(--green-700); }
.product-spec-margin.negative { color: #b6443d; }
.product-spec-remove { display: grid; width: 28px; height: 28px; padding: 0; place-items: center; border: 0; border-radius: 8px; color: #a1443e; background: #fff0ef; font-size: 17px; cursor: pointer; }
.product-spec-remove:disabled { color: #a2ada6; background: #f0f3f1; cursor: not-allowed; }
.market-price-field { display: grid; grid-template-columns: 92px minmax(140px, 220px) minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 13px; color: #526159; font-size: 11px; font-weight: 700; }
.market-price-field > small { color: #8e9a93; font-size: 9px; font-weight: 500; }

.product-switch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-switch-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: 12px; min-height: 75px; padding: 14px 15px; border: 1px solid #dce5df; border-radius: 12px; color: #536159; background: #fafcfb; cursor: pointer; }
.product-switch-card > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.product-switch-card span,
.product-switch-card strong,
.product-switch-card small { display: block; }
.product-switch-card strong { color: #35483d; font-size: 11px; }
.product-switch-card small { margin-top: 5px; color: #87938c; font-size: 9px; font-weight: 500; line-height: 1.45; }
.product-switch-card > i { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #ccd5d0; transition: background .16s ease; }
.product-switch-card > i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(21, 46, 31, .2); transition: transform .16s ease; }
.product-switch-card > input:checked ~ i { background: var(--green-500); }
.product-switch-card > input:checked ~ i::after { transform: translateX(16px); }
.product-switch-card:has(input:checked) { border-color: #a9d9c0; background: #f1faf5; }
.product-switch-card.disabled { opacity: .58; cursor: not-allowed; }
.product-medical-fields { margin-top: 14px; padding: 17px; border: 1px solid #e5e4d8; border-radius: 12px; background: #fffdf6; }
.product-editor-footer { align-items: center; justify-content: space-between; }
.product-editor-footer > span { display: flex; align-items: center; gap: 8px; color: #7d8a82; font-size: 9px; }
.product-editor-footer > span i { width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 4px rgba(25, 163, 99, .1); }
.product-editor-footer > div { display: flex; gap: 9px; }

@media (max-width: 920px) {
  .catalog-editor-dialog.product-editor-dialog-wide { width: calc(100vw - 22px); }
  .product-editor-workspace { grid-template-columns: 155px minmax(0, 1fr); }
  .product-editor-rail { padding-inline: 9px; }
  .product-editor-body { padding: 16px; }
  .product-editor-section { padding: 18px; }
  .product-media-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 16px; }
  .product-main-drop { height: 190px; }
  .product-detail-gallery { grid-template-columns: repeat(2, minmax(92px, 1fr)); }
}

@media (max-width: 700px) {
  .catalog-editor-dialog.product-editor-dialog-wide { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 13px; }
  .product-editor-dialog-wide .catalog-editor-header { padding: 14px 16px; }
  .product-editor-form { min-height: 0; max-height: calc(100vh - 83px); }
  .product-editor-workspace { display: block; overflow-y: auto; }
  .product-editor-rail { display: none; }
  .product-editor-body { overflow: visible; padding: 12px; }
  .product-editor-section { padding: 16px 14px; }
  .product-editor-section .editor-grid,
  .product-switch-grid { grid-template-columns: 1fr; }
  .product-editor-section .editor-grid .wide { grid-column: auto; }
  .product-media-layout { grid-template-columns: 1fr; }
  .product-main-media { max-width: 280px; }
  .product-main-drop { height: 220px; }
  .product-detail-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-price-field { grid-template-columns: 1fr; }
  .product-editor-footer { align-items: stretch; flex-direction: column; }
  .product-editor-footer > span { display: none; }
  .product-editor-footer > div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1320px) {
  .catalog-toolbar { align-items: flex-start; flex-direction: column; }
  .catalog-search-actions { width: 100%; justify-content: flex-start; }
  .catalog-search-actions .search-box { flex: 1; }
}

.ai-consult-shell {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  height: calc(100vh - 186px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: 0 14px 40px rgba(28, 47, 37, .055);
}
.ai-session-panel { display: flex; min-width: 0; min-height: 0; overflow: hidden; flex-direction: column; padding: 17px 14px; border-right: 1px solid var(--line); background: #f8faf9; }
.ai-new-session { width: 100%; min-height: 42px; }
.ai-session-title { margin: 22px 8px 10px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.ai-session-list { display: grid; min-height: 0; gap: 5px; overflow: auto; }
.ai-session-item { display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 5px; width: 100%; min-height: 57px; padding: 8px 7px 8px 11px; border: 0; border-radius: 10px; color: #607067; background: transparent; text-align: left; cursor: pointer; }
.ai-session-item:hover { background: #eef4f0; }
.ai-session-item.active { color: var(--green-700); background: var(--green-100); }
.ai-session-item span { min-width: 0; }
.ai-session-item strong,
.ai-session-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-session-item strong { font-size: 12px; }
.ai-session-item small { margin-top: 5px; color: #8b9790; font-size: 9px; }
.ai-session-item i { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 7px; color: #93a098; font-size: 16px; font-style: normal; }
.ai-session-item i:hover { color: #b44841; background: #fff0ef; }
.ai-no-session { padding: 16px 8px; color: #9aa69f; font-size: 11px; text-align: center; }
.ai-session-notice { margin-top: auto; padding: 14px 9px 2px; border-top: 1px solid var(--line); color: #8b9790; font-size: 9px; line-height: 1.65; }
.ai-chat-panel { display: grid; min-width: 0; min-height: 0; overflow: hidden; grid-template-rows: 68px minmax(0, 1fr) auto; }
.ai-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.ai-chat-header span { color: var(--green-700); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.ai-chat-header h2 { margin: 4px 0 0; font-size: 16px; }
.ai-chat-header b { padding: 5px 9px; border-radius: 999px; color: #2f6ebc; background: #eaf2ff; font-size: 9px; }
.ai-chat-messages { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 25px 28px; background: linear-gradient(180deg, #fbfdfc, #f7faf8); }
.ai-consult-welcome { max-width: 820px; margin: 20px auto; text-align: center; }
.ai-welcome-mark { display: grid; width: 57px; height: 57px; margin: 0 auto; place-items: center; border-radius: 18px; color: white; background: linear-gradient(145deg, var(--green-500), #176b46); box-shadow: 0 12px 28px rgba(25, 163, 99, .22); font-weight: 900; }
.ai-consult-welcome h3 { margin: 19px 0 8px; font-size: 21px; }
.ai-consult-welcome > p { max-width: 610px; margin: 0 auto; color: var(--muted); font-size: 12px; line-height: 1.8; }
.ai-triage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-top: 28px; }
.ai-triage-grid button { display: flex; align-items: center; gap: 11px; min-height: 85px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: white; text-align: left; cursor: pointer; }
.ai-triage-grid button:hover { border-color: #b9dcca; box-shadow: 0 8px 22px rgba(25, 80, 50, .07); }
.ai-triage-grid i { display: grid; width: 37px; height: 37px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #a8581a; background: #fff0e2; font-size: 11px; font-style: normal; font-weight: 800; }
.ai-triage-grid span { min-width: 0; }
.ai-triage-grid strong,
.ai-triage-grid small { display: block; }
.ai-triage-grid strong { font-size: 12px; }
.ai-triage-grid small { margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.ai-message { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 10px; max-width: 860px; margin: 0 auto 19px; }
.ai-message.user { grid-template-columns: minmax(0, 1fr) 35px; }
.ai-message.user .ai-message-avatar { grid-column: 2; }
.ai-message.user .ai-message-content { grid-column: 1; grid-row: 1; justify-self: end; color: white; background: var(--green-700); }
.ai-message-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--green-700); background: var(--green-100); font-size: 10px; font-weight: 900; }
.ai-message-content { max-width: min(100%, 720px); padding: 12px 15px; border: 1px solid #e0e8e3; border-radius: 4px 13px 13px 13px; background: white; box-shadow: 0 5px 18px rgba(28, 47, 37, .04); }
.ai-message-content > p { margin: 0; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.ai-message.user .ai-message-content { border: 0; border-radius: 13px 4px 13px 13px; }
.ai-message-images { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.ai-message-images img { width: 110px; height: 90px; border-radius: 9px; object-fit: cover; }
.ai-image-history { margin: 0 0 7px !important; color: var(--muted); font-size: 10px !important; }
.ai-answer { color: #2c3b33; font-size: 12px; line-height: 1.75; }
.ai-answer h4 { margin: 14px 0 7px; padding: 7px 9px; border-left: 3px solid var(--yellow); border-radius: 6px; color: #664613; background: #fff8e6; font-size: 12px; }
.ai-answer h4:first-child { margin-top: 0; }
.ai-answer p { margin: 7px 0; }
.ai-answer p.risk { padding: 8px 10px; border-radius: 8px; color: #9a3412; background: #fff7ed; }
.ai-answer ul { margin: 7px 0; padding-left: 21px; }
.ai-answer li { margin: 5px 0; }
.ai-answer code { padding: 1px 4px; border-radius: 4px; color: #785115; background: #fff7df; }
.ai-thinking { align-self: center; color: var(--muted); font-size: 11px; }
.ai-thinking span { display: inline-block; width: 5px; height: 5px; margin-right: 3px; border-radius: 50%; background: var(--green-500); animation: ai-pulse 1.1s infinite alternate; }
.ai-thinking span:nth-child(2) { animation-delay: .2s; }
.ai-thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-pulse { to { opacity: .25; transform: translateY(-3px); } }
.ai-composer { padding: 10px 18px 13px; border-top: 1px solid var(--line); background: white; }
.ai-composer form { display: grid; grid-template-columns: 38px minmax(0, 1fr) 70px; align-items: end; gap: 8px; padding: 7px; border: 1px solid #d7e2db; border-radius: 13px; background: #fbfdfc; }
.ai-composer textarea { min-height: 45px; max-height: 110px; padding: 7px 5px; border: 0; outline: 0; color: var(--ink); background: transparent; resize: none; }
.ai-upload-button { width: 37px; height: 37px; border: 0; border-radius: 9px; color: var(--green-700); background: var(--green-100); font-size: 11px; font-weight: 800; cursor: pointer; }
.ai-send-button { min-height: 38px; }
.ai-composer > p { margin: 7px 4px 0; color: #9aa69f; font-size: 9px; text-align: center; }
.ai-quick-prompts { display: flex; gap: 6px; margin-bottom: 7px; overflow-x: auto; }
.ai-quick-prompts button { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: #65736b; background: white; font-size: 9px; cursor: pointer; }
.ai-pending-images { display: flex; gap: 7px; margin-bottom: 7px; }
.ai-pending-images > span { position: relative; }
.ai-pending-images img { width: 58px; height: 48px; border-radius: 8px; object-fit: cover; }
.ai-pending-images button { position: absolute; top: -5px; right: -5px; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; color: white; background: #a83e38; font-size: 12px; cursor: pointer; }

@media (max-width: 1220px) {
  .ai-consult-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .ai-triage-grid { grid-template-columns: 1fr; }
}
