/* Matera Care Assistant — premium conversational surface.
   Uses the Matera design tokens already loaded by the public site. */

.mcg-launcher,
.mcg-panel,
.mcg-panel * { box-sizing: border-box; }

.mcg-launcher {
  position: fixed;
  inset-inline-end: 20px;
  bottom: 20px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 19px 0 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-pill, 999px);
  background:
    linear-gradient(135deg, rgba(255,255,255,.055), transparent 42%),
    var(--ink, #17181A);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .005em;
  box-shadow: 0 16px 38px rgba(23,24,26,.24), 0 3px 10px rgba(23,24,26,.14);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s var(--ease-out, ease), box-shadow .18s ease, background .18s ease;
}
[dir="ltr"] .mcg-launcher { padding: 0 10px 0 19px; }
.mcg-launcher:hover { transform: translateY(-2px); box-shadow: 0 20px 48px rgba(23,24,26,.29), 0 4px 12px rgba(23,24,26,.13); }
.mcg-launcher:active { transform: translateY(0) scale(.985); }
.mcg-launcher:focus-visible { outline: 3px solid var(--focus-ring, rgba(30,73,160,.45)); outline-offset: 3px; }

.mcg-launcher__orb {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.7), transparent 13%),
    linear-gradient(145deg, var(--face, #1E49A0), var(--maple-red, #C8102E));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.26), 0 3px 10px rgba(0,0,0,.22);
}
.mcg-launcher__orb::before {
  content: "✦";
  font-size: 16px;
  line-height: 1;
  color: #fff;
  transform: translateY(-.5px);
}
.mcg-launcher__label { white-space: nowrap; }

.mcg-panel {
  position: fixed;
  inset-inline-end: 20px;
  bottom: 88px;
  z-index: 70;
  width: min(468px, calc(100vw - 32px));
  height: min(76vh, 720px);
  min-height: 540px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255,255,255,.98);
  color: var(--text-body, #2E333A);
  border: 1px solid rgba(226,230,235,.92);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(23,24,26,.20), 0 8px 24px rgba(23,24,26,.08);
  font-size: 14.5px;
  line-height: 1.65;
  transform-origin: bottom var(--mcg-origin, right);
  animation: mcg-in .24s var(--ease-out, ease-out);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
[dir="rtl"] .mcg-panel { --mcg-origin: left; }
.mcg-panel[hidden] { display: none; }
.mcg-panel::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  z-index: 3;
  background: linear-gradient(90deg, var(--face, #1E49A0), var(--daily, #4E9E7A) 52%, var(--maple-red, #C8102E));
}
@keyframes mcg-in {
  from { opacity: 0; transform: translateY(12px) scale(.975); }
  to { opacity: 1; transform: none; }
}

.mcg-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px 14px;
  border-bottom: 1px solid var(--border-faint, #EDF0F3);
  background: rgba(255,255,255,.92);
}
.mcg-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mcg-brand__mark,
.mcg-assistant-avatar {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--ink, #17181A);
  color: #fff;
  font-family: var(--font-display, system-ui);
  font-weight: 800;
}
.mcg-brand__mark {
  width: 40px;
  height: 40px;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(23,24,26,.14);
}
.mcg-head__text { min-width: 0; }
.mcg-head__kicker {
  display: block;
  margin-bottom: 1px;
  font-family: var(--font-display, system-ui);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .17em;
  color: var(--text-faint, #838C98);
}
.mcg-head h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-strong, #17181A);
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.35;
}
.mcg-head__actions { display: flex; align-items: center; gap: 6px; flex: none; }

.mcg-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border, #E2E6EB);
  border-radius: 11px;
  background: #fff;
  color: var(--text-muted, #5C6673);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.mcg-icon-btn:hover { background: var(--bg-subtle, #F7F8FA); border-color: var(--border-strong, #E5E9EE); color: var(--text-strong, #17181A); }
.mcg-icon-btn:active { transform: scale(.96); }
.mcg-icon-btn[hidden] { display: none; }

.mcg-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 17px 14px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  background:
    radial-gradient(circle at 100% 0%, rgba(30,73,160,.045), transparent 34%),
    linear-gradient(180deg, #fff 0%, #FCFDFE 100%);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #E5E9EE) transparent;
}
.mcg-log::-webkit-scrollbar { width: 7px; }
.mcg-log::-webkit-scrollbar-thumb { background: var(--border-strong, #E5E9EE); border-radius: 999px; }

.mcg-intro {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-faint, #EDF0F3);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 10%, rgba(30,73,160,.09), transparent 32%),
    radial-gradient(circle at 0% 100%, rgba(78,158,122,.085), transparent 34%),
    #fff;
  padding: 24px 22px 23px;
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(23,24,26,.06));
}
.mcg-intro[hidden] { display: none; }
.mcg-intro::after {
  content: "M";
  position: absolute;
  inset-inline-end: -11px;
  bottom: -38px;
  font-family: var(--font-display, system-ui);
  font-size: 132px;
  font-weight: 800;
  line-height: 1;
  color: rgba(23,24,26,.028);
  pointer-events: none;
}
.mcg-intro__top { position: relative; z-index: 1; }
.mcg-intro__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-family: var(--font-display, system-ui);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--face, #1E49A0);
}
.mcg-intro__eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.mcg-intro__title {
  max-width: 16ch;
  margin: 0;
  color: var(--text-strong, #17181A);
  font-size: 23px;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: -.012em;
}
.mcg-intro__welcome {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  max-width: 38ch;
  color: var(--text-muted, #5C6673);
  font-size: 13.5px;
  line-height: 1.85;
}

.mcg-row { display: flex; align-items: flex-start; gap: 9px; }
.mcg-row--guide { align-self: stretch; }
.mcg-row--visitor { align-self: stretch; justify-content: flex-end; }
.mcg-assistant-avatar {
  width: 30px;
  height: 30px;
  margin-top: 2px;
  font-size: 10.5px;
  box-shadow: 0 3px 10px rgba(23,24,26,.10);
}

.mcg-guide-body {
  min-width: 0;
  max-width: calc(100% - 39px);
  padding: 12px 13px;
  border: 1px solid var(--border-faint, #EDF0F3);
  border-radius: 6px 16px 16px 16px;
  background: #fff;
  color: var(--text-strong, #17181A);
  box-shadow: 0 2px 8px rgba(23,24,26,.035);
}
[dir="rtl"] .mcg-guide-body { border-radius: 16px 6px 16px 16px; }
.mcg-guide-copy {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  text-align: start;
  color: var(--text-body, #2E333A);
  font-size: 14px;
  line-height: 1.82;
}
.mcg-guide-copy + .mcg-guide-copy { margin-top: 9px; }
.mcg-guide-copy--intro { color: var(--text-strong, #17181A); font-weight: 650; }

.mcg-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  text-align: start;
}
.mcg-msg--visitor {
  border-start-end-radius: 5px;
  background: var(--ink, #17181A);
  color: #fff;
  box-shadow: 0 5px 14px rgba(23,24,26,.11);
}
.mcg-msg--note,
.mcg-msg--error {
  align-self: stretch;
  max-width: none;
  border: 1px solid transparent;
  font-size: 13px;
}
.mcg-msg--note { background: var(--warning-tint, #FCF1DF); border-color: rgba(224,138,30,.17); }
.mcg-msg--error { background: var(--danger-tint, #FBE7EA); border-color: rgba(200,16,46,.12); }

.mcg-thinking__body {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: var(--text-faint, #838C98);
  font-size: 12.5px;
}
.mcg-thinking__dots { display: inline-flex; align-items: center; gap: 3px; }
.mcg-thinking__dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: mcg-dot 1.05s ease-in-out infinite;
}
.mcg-thinking__dots i:nth-child(2) { animation-delay: .13s; }
.mcg-thinking__dots i:nth-child(3) { animation-delay: .26s; }
@keyframes mcg-dot {
  0%, 65%, 100% { opacity: .28; transform: translateY(0); }
  32% { opacity: 1; transform: translateY(-2px); }
}

.mcg-ingredients {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--border, #E2E6EB);
  border-radius: 14px;
  background: var(--bg-subtle, #F7F8FA);
}
.mcg-ingredients__label {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border-faint, #EDF0F3);
  color: var(--text-strong, #17181A);
  font-size: 12px;
  font-weight: 800;
}
.mcg-ingredients__list {
  max-height: 310px;
  overflow-y: auto;
  padding: 4px 0;
  background: #fff;
}
.mcg-ingredient {
  display: grid;
  grid-template-columns: 26px minmax(0,1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 11px;
  border-bottom: 1px solid var(--border-faint, #EDF0F3);
}
.mcg-ingredient:last-child { border-bottom: 0; }
.mcg-ingredient__index {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-muted, #EEF1F4);
  color: var(--text-faint, #838C98);
  font-family: var(--font-display, system-ui);
  font-size: 9.5px;
  font-weight: 700;
}
.mcg-ingredient__name {
  min-width: 0;
  padding-top: 1px;
  color: var(--text-body, #2E333A);
  font-family: var(--font-display, var(--font-body, system-ui));
  font-size: 12.5px;
  line-height: 1.55;
  unicode-bidi: plaintext;
  text-align: start;
  overflow-wrap: anywhere;
}

.mcg-cards {
  display: grid;
  gap: 10px;
  align-self: stretch;
  margin-inline-start: 39px;
}
[dir="rtl"] .mcg-cards { margin-inline-start: 39px; margin-inline-end: 0; }
.mcg-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 98px minmax(0,1fr);
  gap: 12px;
  align-items: center;
  min-height: 126px;
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--border, #E2E6EB);
  border-radius: 18px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(23,24,26,.06));
  transition: transform .18s var(--ease-out, ease), box-shadow .18s ease, border-color .18s ease;
}
[dir="ltr"] .mcg-card { padding: 10px 10px 10px 12px; }
.mcg-card::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--face, #1E49A0);
  opacity: .9;
}
.mcg-card:hover { transform: translateY(-2px); border-color: var(--border-strong, #E5E9EE); box-shadow: var(--shadow-md, 0 8px 24px rgba(23,24,26,.07)); }
.mcg-card__media {
  min-height: 106px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 60%, rgba(30,73,160,.08), transparent 62%),
    var(--bg-subtle, #F7F8FA);
}
.mcg-card__media img {
  width: 88px;
  height: 104px;
  object-fit: contain;
  filter: drop-shadow(0 6px 7px rgba(23,24,26,.12));
}
.mcg-card__body { display: block; min-width: 0; }
.mcg-card__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--face, #1E49A0);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.mcg-card__title {
  display: block;
  color: var(--text-strong, #17181A);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}
.mcg-card__size {
  display: block;
  margin-top: 1px;
  color: var(--text-faint, #838C98);
  font-family: var(--font-display, system-ui);
  font-size: 10.5px;
}
.mcg-card__reason {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text-muted, #5C6673);
  font-size: 11.5px;
  line-height: 1.55;
}
.mcg-card__cta {
  display: block;
  margin-top: 7px;
  color: var(--text-strong, #17181A);
  font-size: 11.5px;
  font-weight: 800;
}

.mcg-starters {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 0 17px 13px;
  background: #fff;
}
.mcg-starters[hidden] { display: none; }
.mcg-chip {
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 26px minmax(0,1fr) 16px;
  gap: 7px;
  align-items: center;
  padding: 8px 9px;
  text-align: start;
  border: 1px solid var(--border, #E2E6EB);
  border-radius: 14px;
  background: #fff;
  color: var(--text-body, #2E333A);
  font: inherit;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.mcg-chip:hover { transform: translateY(-1px); border-color: var(--border-strong, #E5E9EE); background: var(--bg-subtle, #F7F8FA); }
.mcg-chip__mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-muted, #EEF1F4);
  color: var(--text-faint, #838C98);
  font-family: var(--font-display, system-ui);
  font-size: 9px;
  font-weight: 700;
}
.mcg-chip__text {
  min-width: 0;
  color: var(--text-strong, #17181A);
  font-size: 11.5px;
  line-height: 1.5;
  font-weight: 650;
}
.mcg-chip__arrow { color: var(--text-faint, #838C98); font-size: 13px; }

.mcg-composer {
  flex: none;
  padding: 10px 13px 12px;
  border-top: 1px solid var(--border-faint, #EDF0F3);
  background: rgba(255,255,255,.96);
}
.mcg-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 5px 5px 5px 11px;
  border: 1px solid var(--border, #E2E6EB);
  border-radius: 17px;
  background: var(--bg-subtle, #F7F8FA);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
[dir="rtl"] .mcg-form { padding: 5px 11px 5px 5px; }
.mcg-form:focus-within {
  border-color: color-mix(in srgb, var(--face, #1E49A0) 42%, var(--border, #E2E6EB));
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30,73,160,.07);
}
.mcg-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 112px;
  padding: 8px 2px 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-strong, #17181A);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
}
.mcg-input::placeholder { color: var(--text-faint, #838C98); }
.mcg-send {
  width: 39px;
  height: 39px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--ink, #17181A);
  color: #fff;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.mcg-send:hover { background: var(--face, #1E49A0); }
.mcg-send:active { transform: scale(.96); }
.mcg-send:disabled,
.mcg-input:disabled { opacity: .48; cursor: not-allowed; }
.mcg-send__arrow { font-size: 18px; line-height: 1; }

.mcg-action-row { align-self: stretch; padding-inline-start: 39px; }
.mcg-action {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border, #E2E6EB);
  border-radius: var(--radius-pill, 999px);
  background: #fff;
  color: var(--text-strong, #17181A);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.mcg-action--primary { background: var(--ink, #17181A); color: #fff; border-color: var(--ink, #17181A); }

.mcg-turnstile { flex: none; padding: 0 13px; }
.mcg-turnstile:empty { display: none; }

.mcg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mcg-icon-btn:focus-visible,
.mcg-chip:focus-visible,
.mcg-card:focus-visible,
.mcg-send:focus-visible,
.mcg-action:focus-visible,
.mcg-input:focus-visible {
  outline: 3px solid var(--focus-ring, rgba(30,73,160,.45));
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .mcg-launcher {
    inset-inline-end: 14px;
    bottom: 14px;
    min-height: 50px;
    padding-inline-end: 16px;
  }
  .mcg-launcher__orb { width: 35px; height: 35px; }

  .mcg-panel {
    inset-inline: 0;
    bottom: 0;
    width: 100vw;
    height: min(90svh, 760px);
    max-height: 90svh;
    min-height: 0;
    border-inline: 0;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
  }
  body.mcg-open .mcg-launcher { display: none; }

  .mcg-head { padding: 14px 14px 12px; }
  .mcg-log { padding: 16px 13px 12px; }
  .mcg-intro { padding: 21px 18px 20px; }
  .mcg-intro__title { font-size: 21px; }
  .mcg-starters { padding: 0 13px 11px; }
  .mcg-chip { min-height: 58px; }
  .mcg-cards { margin-inline-start: 0; }
  [dir="rtl"] .mcg-cards { margin-inline-start: 0; }
  .mcg-card { grid-template-columns: 86px minmax(0,1fr); min-height: 118px; }
  .mcg-card__media { min-height: 98px; }
  .mcg-card__media img { width: 78px; height: 96px; }
  .mcg-composer { padding: 9px 10px max(10px, env(safe-area-inset-bottom)); }
  .mcg-guide-body { max-width: calc(100% - 39px); }
}

@media (max-width: 390px) {
  .mcg-starters { grid-template-columns: 1fr; }
  .mcg-intro__title { max-width: 18ch; }
}

@media (prefers-reduced-motion: reduce) {
  .mcg-panel { animation: none; }
  .mcg-launcher,
  .mcg-chip,
  .mcg-card,
  .mcg-icon-btn,
  .mcg-send { transition: none; transform: none; }
  .mcg-thinking__dots i { animation: none; opacity: .55; }
  .mcg-log { scroll-behavior: auto; }
}
