:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --soft: #f5f3ef;
  --soft-2: #efebe4;
  --ink: #24272c;
  --muted: #62666d;
  --line: #e4e1db;
  --accent: #9c4027;
  --accent-dark: #7d311c;
  --accent-soft: #f9efe9;
  --ok-bg: #eef7f1;
  --ok-ink: #1f6b3e;
  --ok-line: #cde5d5;
  --warn-bg: #fdf6e7;
  --warn-ink: #8a5a12;
  --warn-line: #f0dfb9;
  --err-bg: #fdf0ee;
  --err-ink: #a62f23;
  --err-line: #f1cbc6;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(36, 39, 44, 0.05);
  --shadow-md: 0 8px 28px rgba(36, 39, 44, 0.12);
  --font: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body.advice-page {
  margin: 0;
  min-height: var(--advice-vh, 100dvh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: clip;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

button,
input,
select,
textarea {
  font: inherit;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Unified V6 Top Header & Dynamic Pet Portrait */
.advice-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 247, 242, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.advice-header-inner {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pet-avatar-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  padding: 2px 8px 2px 2px;
  border-radius: 999px;
}

.pet-avatar-link:hover {
  background: var(--soft);
}

.pet-portrait-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #e7a387 0%, #c66443 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pet-portrait-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fffaf4;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pet-portrait-inner svg,
.pet-portrait-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pet-badge-copy strong {
  display: block;
  font-size: 14.5px;
  line-height: 1.2;
}

.pet-badge-copy small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.advice-desktop-nav {
  display: flex;
  gap: 4px;
}

.dnav-link {
  text-decoration: none;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
}

.dnav-link:hover {
  color: var(--ink);
  background: var(--soft);
}

.dnav-link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 960px) and (min-width: 769px) {
  .advice-header-inner {
    padding: 8px 12px;
    gap: 8px;
  }
  .dnav-link {
    padding: 6px 9px;
    font-size: 13px;
  }
  .pet-badge-copy small {
    display: none;
  }
  .advice-header-actions .nav-pill {
    padding: 5px 9px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .advice-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 14px;
  }

  .advice-desktop-nav {
    display: none;
  }

  .pet-avatar-link {
    min-width: 0;
    padding: 2px 6px 2px 2px;
    gap: 8px;
  }

  .pet-portrait-ring {
    width: 36px;
    height: 36px;
  }

  .pet-badge-copy {
    min-width: 0;
  }

  .pet-badge-copy strong {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pet-badge-copy small {
    display: none;
  }

  .advice-header-actions {
    gap: 6px;
  }

  .advice-header-actions .nav-pill {
    min-height: 34px;
    padding: 4px 11px;
    font-size: 12.5px;
    border-radius: 999px;
  }

  .mobile-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(190%) blur(22px);
    -webkit-backdrop-filter: saturate(190%) blur(22px);
    border: 1px solid rgba(60, 48, 36, 0.08);
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(32, 24, 16, 0.11), 0 1px 2px rgba(32, 24, 16, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.92);
    padding: 5px 6px;
  }

  .mtab {
    border: 0;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 2px;
    border-radius: 999px;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease, transform 120ms ease;
  }
  .mtab:active { transform: scale(0.94); }
  .mtab.is-active {
    background: rgba(184, 80, 50, 0.11);
    color: var(--accent);
  }
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 2px;
    text-decoration: none;
  }

  .mtab svg {
    width: 21px;
    height: 21px;
  }

  .mtab.is-active {
    color: var(--accent);
  }

  .mtab-ai .ai-orb {
    width: 40px;
    height: 28px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mtab-ai.is-active .ai-orb {
    background: var(--accent);
    color: #ffffff;
  }

  .mtab-ai .ai-orb svg {
    width: 17px;
    height: 17px;
  }
}

.advice-nav-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

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

.advice-brand h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.advice-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-pill-secondary {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #ebd4c8;
}

/* Main Content */
.advice-main {
  flex: 1 1 auto;
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 14px 16px 28px;
}

/* Condition Summary Bar */
.condition-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.condition-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.condition-summary-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.condition-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cond-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.cond-chip-pet {
  background: var(--accent-soft);
  border-color: #ead1c4;
  color: #6b2917;
  font-weight: 600;
}

.cond-chip-budget {
  background: #f0f6f3;
  border-color: #cbe0d4;
  color: #1f5a38;
}

.cond-chip-need {
  background: #f2f4fb;
  border-color: #d3daf0;
  color: #29417a;
}

.cond-chip-exclude {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-ink);
}

.cond-chip-note {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

.condition-delta {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  color: var(--ok-ink);
  font-size: 13px;
  line-height: 1.5;
}

/* Collapsible Check Panel */
.check-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.check-panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  user-select: none;
}

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

.check-panel-summary::after {
  content: '展开 ▾';
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
}

.check-panel[open] > .check-panel-summary::after {
  content: '收起 ▴';
}

.check-panel-summary small {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-right: auto;
}

.check-panel-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.check-form {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.check-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.check-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.check-form .field-wide {
  grid-column: 1 / -1;
}

.check-form input,
.check-form select {
  width: 100%;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid #d4cfc6;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

.extra-needs-notice {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--soft);
  font-size: 13px;
  color: var(--muted);
}

.selection-fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 12px;
}

.selection-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.selection-fieldset label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.selection-fieldset input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.profile-import-btn {
  justify-self: start;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid #e4c9bc;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.check-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-result {
  margin-top: 10px;
  font-size: 14px;
}

.check-result p {
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.check-result details {
  margin: 6px 0;
  padding: 8px 10px;
  background: var(--soft);
  border-radius: 9px;
  border: 1px solid var(--line);
}

/* iOS Tactile Buttons & High-Craft Dropdowns */
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2362666d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #f9f6f1 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: right 11px center, 0 0;
  background-size: 14px 14px, 100% 100%;
  padding-right: 34px !important;
  border: 1px solid rgba(60, 48, 36, 0.16) !important;
  border-radius: 11px !important;
  box-shadow: 0 1px 2px rgba(32, 24, 16, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  cursor: pointer;
}
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3.5px rgba(156, 64, 39, 0.14);
  outline: none;
}

.btn-primary,
.btn-secondary,
.btn-send,
.btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 120ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 140ms ease, background 140ms ease, border-color 140ms ease, color 120ms ease;
}

.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.btn-send:active:not(:disabled),
.btn-subtle:active:not(:disabled),
.nav-pill:active:not(:disabled),
.composer-tool-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-primary {
  border: 1px solid rgba(184, 80, 50, 0.32);
  background: rgba(184, 80, 50, 0.76);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(184, 80, 50, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.btn-primary:hover:not(:disabled) {
  background: rgba(170, 67, 39, 0.85);
  box-shadow: 0 6px 20px rgba(184, 80, 50, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.btn-send {
  border: 1px solid rgba(184, 80, 50, 0.34);
  border-radius: 999px;
  min-height: 38px;
  padding: 6px 16px;
  background: rgba(184, 80, 50, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  color: #ffffff;
  box-shadow: 0 5px 16px rgba(184, 80, 50, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.btn-send:hover:not(:disabled) {
  background: rgba(170, 67, 39, 0.88);
  box-shadow: 0 7px 20px rgba(184, 80, 50, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.btn-send svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-secondary {
  border: 1px solid rgba(60, 48, 36, 0.11);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(32, 24, 16, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(156, 64, 39, 0.35);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-secondary.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Per-Message Action Bar (Copy / Thumbs Up / Thumbs Down / Follow-up) */
.msg-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(60, 48, 36, 0.07);
}
.msg-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: all 120ms ease;
}
.msg-act-btn:hover {
  background: var(--soft);
  color: var(--ink);
  border-color: rgba(60, 48, 36, 0.09);
}
.msg-act-btn:active { transform: scale(0.95); }
.msg-act-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(156, 64, 39, 0.25);
}

/* Smart Contextual Follow-Up Chips */
.followup-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.followup-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.followup-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(156, 64, 39, 0.2);
  background: linear-gradient(180deg, #fffaf6 0%, #f9ede5 100%);
  color: #772f1b;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(156, 64, 39, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.followup-chip:hover:not(:disabled) {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff5ee 0%, #f4dfd2 100%);
}
.followup-chip:active:not(:disabled) { transform: scale(0.96); }

.btn-subtle {
  border: 1px solid transparent;
  background: var(--soft);
  color: var(--ink);
}

.btn-subtle:hover:not(:disabled) {
  background: var(--soft-2);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Empty Welcome State */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 6px 0 14px;
  box-shadow: var(--shadow-sm);
}

.welcome-card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.welcome-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.sample-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sample-prompt-btn {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.sample-prompt-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* Messages */
.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-article {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}

.msg-article.user {
  align-self: flex-end;
  max-width: min(88%, 640px);
  background: var(--accent-soft);
  border-color: #ebd5c9;
}

.msg-article.assistant {
  align-self: stretch;
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.msg-role {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.msg-article.user .msg-role {
  color: #6b2917;
}

.msg-tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--soft);
  padding: 2px 7px;
  border-radius: 999px;
}

/* Rich Markdown Body */
.msg-body {
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink);
}

.msg-body > :first-child {
  margin-top: 0;
}

.msg-body > :last-child {
  margin-bottom: 0;
}

.msg-body p {
  margin: 0.55em 0;
  white-space: pre-line;
}

.msg-body h4,
.msg-body h5 {
  margin: 0.9em 0 0.4em;
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--ink);
}

.msg-body ul,
.msg-body ol {
  margin: 0.45em 0 0.65em;
  padding-left: 1.35em;
}

.msg-body li {
  margin: 0.3em 0;
}

.msg-body strong {
  font-weight: 700;
  color: #191b1f;
}

.msg-body code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 5px;
}

/* Inline Source Citation Badges */
.cite-pill {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  min-height: 22px;
  margin: 0 2px;
  padding: 1px 7px;
  border: 1px solid #e2c8bc;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

.cite-pill:hover {
  background: #f1dcd0;
  border-color: var(--accent);
}

.cite-pill-plain {
  background: var(--soft);
  border-color: var(--line);
  color: var(--muted);
}

/* Collapsible Sources Drawer inside Message */
.msg-sources {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.msg-sources summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.msg-sources summary:hover {
  color: var(--accent);
}

.source-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--soft);
  font-size: 13px;
  transition: background-color 200ms ease, box-shadow 200ms ease;
}

.source-item.is-highlighted {
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px #dfb5a4;
}

.source-key {
  display: inline-block;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-dark);
  background: var(--surface);
  border: 1px solid #e2c8bc;
  border-radius: 6px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.source-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
}

.source-meta {
  color: var(--muted);
  font-size: 12px;
}

/* Pending / Waiting Real AI Card */
.pending-card {
  border-color: #e4c9bc;
  background: linear-gradient(180deg, #fffdfb 0%, #fcf7f3 100%);
}

.pending-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pending-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid #e8d2c7;
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

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

.pending-stage {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.pending-detail {
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink);
}

.pending-meta {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.pending-elapsed {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-dark);
}

/* Product Recommendation Cards */
.msg-cards,
.retained-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.retained-products {
  margin-top: 14px;
}

.retained-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.retained-heading small {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.refCard {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.refCard.is-historical {
  padding: 10px 12px;
  background: #fafafa;
}

.refCard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 10px;
}

.refCard-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.refCard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.status-badge.is-eligible {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok-ink);
}

.status-badge.is-unknown {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

.status-badge.is-excluded {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-ink);
}

.refCard-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--muted);
}

.refCard-price {
  color: var(--accent-dark);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.refCard-breakdown {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
}

.refCard-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px;
}

.refCard-row dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.refCard-row dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.refCard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.refCard-actions button {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 13.5px;
}

/* Compare Action Area */
.compare-area {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.compare-area:empty {
  display: none;
}

/* Inspection / Comparison Dialog */
.inspection-dialog {
  width: min(96vw, 840px);
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.inspection-dialog[open] {
  display: flex;
  flex-direction: column;
}

.inspection-dialog::backdrop {
  background: rgba(24, 26, 30, 0.45);
}

.inspection-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}

.inspection-head h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.inspection-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.compare-verdict {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #ead1c4;
  margin-bottom: 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: #5e2414;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg);
  min-width: 0;
}

.detail-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}

.detail-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.detail-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.detail-section h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.detail-kv {
  margin: 0;
  display: grid;
  gap: 5px;
  font-size: 13.5px;
}

.detail-kv-row {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr);
  gap: 6px;
}

.detail-kv-row dt {
  margin: 0;
  color: var(--muted);
}

.detail-kv-row dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-note-list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 13.5px;
}

.detail-note-list li {
  margin: 4px 0;
}

.detail-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.detail-loading {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Sticky Bottom Composer Dock */
.composer-dock {
  position: sticky;
  bottom: 0;
  z-index: 25;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
}

.composer-inner {
  width: min(100%, 880px);
  margin: 0 auto;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 13.5px;
}

.status-bar.is-error {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-ink);
}

.status-bar.is-busy {
  background: var(--accent-soft);
  border-color: #e4c9bc;
  color: #6b2917;
}

.status-text {
  margin: 0;
  flex: 1 1 200px;
  overflow-wrap: anywhere;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-actions button {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 13px;
}

.ask-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1.5px solid #d5cfc6;
  border-radius: 14px;
  background: var(--surface);
  padding: 8px 10px 8px 12px;
  transition: border-color 120ms ease;
}

.ask-form:focus-within {
  border-color: var(--accent);
}

.ask-form textarea {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  border: 0;
  padding: 4px 2px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  outline: none;
}

.ask-form textarea::placeholder {
  color: #82868c;
}

.ask-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ask-hint {
  font-size: 12px;
  color: var(--muted);
}

.btn-send {
  min-width: 82px;
  min-height: 40px;
  padding: 6px 16px;
  border-radius: 10px;
}

.advice-footer {
  margin: 6px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Mobile Responsive (must come AFTER base .composer-dock rules) */
@media (max-width: 768px) {
  html:has(body.advice-page) {
    height: var(--advice-vh, 100dvh);
    overflow: hidden;
  }

  body.advice-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--advice-vh, 100dvh);
    max-height: var(--advice-vh, 100dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
  }

  .advice-header {
    flex: 0 0 auto;
    position: relative;
    top: auto;
  }

  .advice-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 10px 12px 14px;
  }

  .composer-dock {
    flex: 0 0 auto;
    position: relative;
    bottom: auto;
    padding: 8px 12px calc(76px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(250, 248, 245, 0.94) 0%, #faf8f5 28%, #faf8f5 100%);
    transition: padding-bottom 160ms ease;
  }

  .mobile-tabbar {
    transition: transform 160ms ease, opacity 140ms ease;
  }

  .advice-footer {
    display: none;
  }

  .ask-form {
    padding: 6px 8px 6px 10px;
    gap: 4px;
  }

  .ask-form textarea {
    min-height: 36px;
    max-height: 96px;
    font-size: 16px;
    line-height: 1.4;
  }

  .btn-send {
    min-height: 34px;
    padding: 4px 14px;
    font-size: 13px;
  }

  .ask-hint {
    display: none;
  }

  .ask-toolbar {
    justify-content: flex-end;
  }

  body.is-keyboard-open .mobile-tabbar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(120%);
  }

  body.is-keyboard-open .composer-dock {
    padding-bottom: 8px;
  }
}

@media (max-width: 680px) {
  .advice-brand h1 {
    font-size: 1.02rem;
  }

  .advice-subtitle {
    display: none;
  }

  .welcome-card {
    padding: 14px;
  }

  .welcome-card h2 {
    font-size: 1.05rem;
  }

  .welcome-card p {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .sample-prompt-btn {
    width: 100%;
    font-size: 13px;
    line-height: 1.45;
  }

  .check-panel-summary small {
    display: none;
  }

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

  .check-form input,
  .check-form select {
    min-width: 0;
  }

  .selection-fieldset {
    grid-template-columns: 1fr;
  }

  .msg-article {
    padding: 12px 13px;
  }

  .msg-article.user {
    max-width: 92%;
  }

  .refCard-row {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .detail-kv-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .inspection-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 92dvh;
    max-height: 92dvh;
    margin-top: auto;
    border-radius: 16px 16px 0 0;
  }
}

.advice-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.needs-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.need-pill-check {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid #d4cfc6;
  background: var(--surface);
  color: var(--ink) !important;
  font-size: 13px !important;
  cursor: pointer;
  user-select: none;
}

.need-pill-check input {
  width: 15px !important;
  height: 15px !important;
  min-height: 15px !important;
  margin: 0;
  accent-color: var(--accent);
}

.need-pill-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark) !important;
  font-weight: 600;
}

.source-kind {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.source-id {
  color: var(--muted);
  font-size: 12px;
}

.source-jump-btn {
  margin-left: auto;
  padding: 2px 9px;
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}

.source-jump-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.supply-card {
  border-color: #d6e4dc;
  background: #fbfdfc;
}

.status-badge.is-supply {
  background: #edf5f1;
  border-color: #cbe0d5;
  color: #1f5c3e;
}

.supply-src-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.pet-avatar-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.pet-portrait-ring.is-neutral {
  background: linear-gradient(135deg, #e7dfd6 0%, #cfc3b7 100%);
}

.history-review-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 13px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 13px;
  font-weight: 600;
}

.history-review-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.history-review-actions button {
  min-height: 32px;
  padding: 4px 11px;
  font-size: 12.5px;
}

/* Contextual Shopping Filter Strip (only visible in food shopping mode) */
.shopping-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.shopping-filter-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 auto;
  min-width: 0;
}

.shopping-filter-tags::-webkit-scrollbar {
  display: none;
}

.sf-mini-tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid #dfd7cc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.sf-mini-hint {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.shopping-filter-edit {
  border: 1px solid #e4c9bc;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.ask-toolbar-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.composer-tool-btn {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  min-height: 32px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.composer-tool-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.composer-tool-btn.is-active {
  border-color: #e4c9bc;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* Native-style Sheet Dialogs (Pet Context, History, Simple Filter) */
.sheet-dialog {
  width: min(94vw, 520px);
  max-height: 86dvh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.sheet-dialog[open] {
  display: flex;
  flex-direction: column;
}

.sheet-dialog::backdrop {
  background: rgba(24, 26, 30, 0.45);
}

.sheet-dialog .inspection-head {
  justify-content: space-between;
}

.sheet-close-btn {
  min-height: 34px;
  padding: 4px 12px;
  font-size: 13px;
}

.sheet-body {
  padding: 14px 16px 26px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.sheet-section-title {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.ctx-pet-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ctx-option {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.ctx-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ctx-neutral-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--soft-2);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.ctx-option-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.ctx-option-copy strong {
  display: block;
  font-size: 14px;
}

.ctx-option-copy small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.ctx-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid #e4c9bc;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ctx-sync-btn {
  border: 1px solid #e4c9bc;
  background: var(--surface);
  color: var(--accent);
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.sheet-footer-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

/* History List */
.history-sheet-top {
  margin-bottom: 12px;
}

.history-empty {
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 18px 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.history-item.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.history-item-main {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.history-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-title-row strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-live-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--ok-ink);
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  padding: 1px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.history-item-main small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.history-del-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.history-del-btn:hover {
  color: var(--err-ink);
  background: var(--err-bg);
}

/* Simplified Food Filter Sheet */
.simple-filter-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sf-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sf-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.sf-chip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.sf-chip-row::-webkit-scrollbar {
  display: none;
}

.sf-chip {
  border: 1px solid #d4cfc6;
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.sf-chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

.simple-filter-form input,
.simple-filter-form select {
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid #d4cfc6;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  min-width: 0;
}

.sf-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.sf-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  padding-top: 4px;
}

@media (max-width: 768px) {
  .ask-toolbar {
    justify-content: space-between;
  }

  .sheet-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 85dvh;
    margin-top: auto;
    border-radius: 18px 18px 0 0;
  }
}

/* Compact AI Product & Supply Cards (thumbnail + name + minimal meta, tap for full details) */
.compact-prod-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.compact-prod-card:hover {
  border-color: #d7c7bc;
  background: #fdfbf9;
}

.compact-prod-card.is-supply {
  border-color: #d6e4dc;
  background: #f9fcfa;
}

.compact-prod-card.is-historical {
  opacity: 0.88;
}

.compact-prod-main {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.compact-prod-thumb {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--soft);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.compact-prod-thumb.is-supply {
  background: #edf5f1;
  border-color: #cfe2d7;
}

.compact-prod-thumb svg {
  width: 30px;
  height: 30px;
}

.compact-prod-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.compact-prod-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.compact-prod-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

.compact-prod-meta .status-badge {
  font-size: 11px;
  padding: 1px 7px;
}

.compact-prod-price {
  color: var(--accent-dark);
  font-weight: 600;
}

.compact-prod-chev {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.compact-cmp-btn {
  flex-shrink: 0;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d5cfc6;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.compact-cmp-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.compact-cmp-btn.is-selected {
  border-color: var(--ok-line);
  background: var(--ok-bg);
  color: var(--ok-ink);
}

/* Docked Compare Strip (above composer when 1-2 items selected) */
.compare-dock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding: 7px 11px;
  border-radius: 12px;
  background: #231f1c;
  color: #faf7f2;
  font-size: 12.5px;
}

.compare-dock-info {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-dock-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.compare-dock-btn {
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.compare-dock-btn.is-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #e6dfd7;
}

.compare-dock-btn.is-secondary {
  background: #ffffff;
  color: #231f1c;
}

.compare-dock-btn.is-primary {
  background: var(--accent);
  color: #ffffff;
}

.compare-dock-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .pending-spinner {
    animation: none;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
