/* ==========================================================================
   BoochVision — Apple-modern product UI (Living Culture light)
   Tokens inherit from startup.css :root.
   ========================================================================== */

.bv {
  --bv-max: 680px;
  --bv-wide: 920px;
  --bv-radius: var(--radius-lg, 24px);
  --bv-radius-sm: var(--radius-sm, 12px);
  --bv-ease: var(--ease-out, cubic-bezier(0.25, 0.46, 0.45, 0.94));
  --bv-z-companion: 50;
  --bv-z-fab: 55;
  --bv-z-dialog: 70;
  --bv-z-toast: 80;
  --bv-panel: var(--surface);
  --bv-shadow: var(--shadow-soft, 0 4px 24px rgba(0, 0, 0, 0.06));
  --bv-shadow-lg: var(--shadow-card, 0 12px 40px rgba(0, 0, 0, 0.08));
  position: relative;
  z-index: 1;
  min-height: calc(100vh - var(--header-height) - 100px);
  padding: clamp(20px, 4vh, 40px) 20px 140px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, color-mix(in srgb, var(--teal-soft) 55%, transparent), transparent 70%),
    var(--paper);
}

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

#bv-app,
.bv-app {
  width: min(100%, var(--bv-wide));
  margin: 0 auto;
}

.bv-shell {
  width: min(100%, var(--bv-wide));
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.bv-shell-narrow {
  width: min(100%, var(--bv-max));
}

/* —— Views ————————————————————————————————————————————————————————————— */

.bv-view[hidden],
.bv-view:not(.is-active) {
  display: none !important;
}

.bv-view.is-active {
  display: block;
  animation: bv-view-in 480ms var(--bv-ease) both;
}

@keyframes bv-view-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— Typography ——————————————————————————————————————————————————————— */

.bv-mono-label {
  margin: 0 0 12px;
  color: var(--teal);
  font-family: var(--font-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bv-mono-label::before {
  display: none;
}

.bv-display {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.bv-display span {
  color: var(--teal);
}

.bv-section-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.bv-lede {
  margin: 0;
  max-width: 40ch;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 2vw, 1.18rem);
  line-height: 1.5;
  text-wrap: pretty;
}

.bv-hero {
  text-align: center;
  justify-items: center;
  display: grid;
  gap: 0;
  padding-top: 4px;
}

.bv-hero .bv-lede {
  margin-inline: auto;
}

.bv-hero .bv-mono-label {
  margin-bottom: 14px;
}

.bv-section-head {
  margin-bottom: 4px;
}

.bv-brews-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

/* —— Tips (pill chips) ———————————————————————————————————————————————— */

.bv-tips {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
}

.bv-tips .bv-mono-label {
  margin-bottom: 14px;
}

.bv-tip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.bv-tip-list li {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--radius-pill, 980px);
  background: var(--surface);
  box-shadow: var(--bv-shadow);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
  max-width: 36ch;
}

.bv-tip-list li::before {
  display: none;
}

/* —— Dropzone ————————————————————————————————————————————————————————— */

.bv-scan-form {
  display: grid;
  gap: 18px;
  width: min(100%, var(--bv-max));
  margin-inline: auto;
}

.bv-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 36px 28px;
  border-radius: var(--bv-radius);
  background: var(--surface);
  box-shadow: var(--shadow-product, 0 32px 64px -24px rgba(0, 0, 0, 0.14));
  cursor: pointer;
  overflow: hidden;
  transition: transform 240ms var(--bv-ease), box-shadow 240ms var(--bv-ease);
}

.bv-dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 100%, color-mix(in srgb, var(--teal) 8%, transparent), transparent 70%);
  pointer-events: none;
}

.bv-dropzone:hover,
.bv-dropzone.is-dragover {
  transform: translateY(-3px);
  box-shadow: 0 40px 72px -28px rgba(0, 0, 0, 0.18);
}

.bv-dropzone.has-photo {
  min-height: 300px;
  padding: 14px;
}

.bv-dropzone-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  max-width: 28ch;
}

.bv-dropzone.has-photo .bv-dropzone-copy {
  display: none;
}

.bv-dropzone-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--teal-soft) 70%, var(--surface));
  color: var(--teal);
  font-size: 1.45rem;
  line-height: 1;
}

.bv-dropzone-prompt {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

.bv-dropzone-hint {
  color: var(--ink-mute);
  font-size: 0.9rem;
}

.bv-choose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-pill, 980px);
  background: var(--teal);
  color: var(--white);
  font-weight: 500;
  font-size: 0.92rem;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--teal) 28%, transparent);
}

.bv-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.bv-preview {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-height: 380px;
  border-radius: calc(var(--bv-radius) - 8px);
  overflow: hidden;
}

.bv-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 380px;
  object-fit: cover;
}

.bv-scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.bv-analyze-btn {
  min-height: 48px;
  min-width: min(100%, 240px);
  font-size: 1rem;
}

.bv-terms-note {
  margin: 0;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.8rem;
  line-height: 1.5;
}

.bv-terms-note a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}

.bv-terms-note a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bv-form-error {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--bv-radius-sm);
  background: color-mix(in srgb, var(--error-ink) 10%, var(--surface));
  color: var(--error-ink);
  font-size: 0.92rem;
  text-align: center;
}

.bv-form-error[hidden] {
  display: none !important;
}

/* —— Analyzing ———————————————————————————————————————————————————————— */

.bv-analyzing {
  padding: clamp(40px, 8vw, 64px) 28px;
  border-radius: var(--bv-radius);
  background: var(--surface);
  box-shadow: var(--bv-shadow-lg);
  text-align: center;
}

.bv-analyzing-meter {
  height: 3px;
  margin: 28px auto 20px;
  max-width: 200px;
  border-radius: 999px;
  background: var(--paper-dim);
  overflow: hidden;
}

.bv-analyzing-fill {
  display: block;
  height: 100%;
  width: 32%;
  border-radius: inherit;
  background: var(--teal);
  animation: bv-meter 1.5s var(--bv-ease) infinite;
}

@keyframes bv-meter {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(360%);
  }
}

.bv-analyzing-stage {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  font-weight: 500;
}

.bv-analyzing-thumb {
  margin: 28px auto 0;
  width: min(100%, 120px);
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--bv-shadow);
  opacity: 0.92;
}

.bv-analyzing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* —— Result ——————————————————————————————————————————————————————————— */

.bv-result {
  padding: clamp(28px, 5vw, 36px);
  border-radius: var(--bv-radius);
  background: var(--surface);
  box-shadow: var(--bv-shadow-lg);
  display: grid;
  gap: 18px;
}

.bv-result[data-result-state="mold_likely"],
.bv-result[data-result-state="not_scoby"] {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--error-ink) 6%, var(--surface)) 0%, var(--surface) 40%);
}

.bv-result[data-result-state="kahm_likely"],
.bv-result[data-result-state="unsure"] {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--amber) 8%, var(--surface)) 0%, var(--surface) 40%);
}

.bv-result[data-result-state="healthy_looking"] {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--ready) 10%, var(--surface)) 0%, var(--surface) 40%);
}

.bv-result-chip {
  justify-self: start;
  min-height: 28px;
  padding: 4px 14px;
  border-radius: var(--radius-pill, 980px);
  background: var(--paper-dim);
  border: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bv-result-chip::before {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.bv-result[data-result-state="mold_likely"] .bv-result-chip,
.bv-result[data-result-state="not_scoby"] .bv-result-chip {
  color: var(--error-ink);
  background: color-mix(in srgb, var(--error-ink) 12%, var(--surface));
}

.bv-result[data-result-state="mold_likely"] .bv-result-chip::before,
.bv-result[data-result-state="not_scoby"] .bv-result-chip::before {
  background: var(--error-ink);
}

.bv-result[data-result-state="kahm_likely"] .bv-result-chip,
.bv-result[data-result-state="unsure"] .bv-result-chip {
  color: var(--amber-ink);
  background: color-mix(in srgb, var(--amber-soft) 60%, var(--surface));
}

.bv-result[data-result-state="healthy_looking"] .bv-result-chip {
  color: var(--success-ink);
  background: color-mix(in srgb, var(--ready-soft) 55%, var(--surface));
}

.bv-result[data-result-state="healthy_looking"] .bv-result-chip::before {
  background: var(--ready);
}

.bv-result-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}

.bv-result-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.bv-result-lists {
  display: grid;
  gap: 20px;
  padding-top: 4px;
}

.bv-result-block {
  padding: 16px 18px;
  border-radius: var(--bv-radius-sm);
  background: var(--paper-dim);
}

.bv-result-block .bv-mono-label {
  margin-bottom: 10px;
}

.bv-result-block ul,
.bv-result-block ol,
.bv-insight-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.bv-result-disclaimer {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--bv-radius-sm);
  background: var(--paper-dim);
  color: var(--ink-mute);
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
}

.bv-feedback-row,
.bv-soft-gate-actions,
.bv-save-batch-row,
.bv-inline-actions,
.bv-result-actions,
.bv-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bv-feedback-row .button,
.bv-soft-gate-actions .button,
.bv-result-actions .button,
.bv-auth-actions .button,
.bv-inline-actions .button {
  min-height: 44px;
}

.bv-result-actions {
  justify-content: center;
  padding-top: 4px;
}

.bv-feedback-thanks {
  margin: 0;
  color: var(--success-ink);
  font-size: 0.92rem;
}

.bv-insight {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: var(--bv-radius-sm);
  background: color-mix(in srgb, var(--teal-soft) 35%, var(--surface));
  border: 0;
}

.bv-insight-why {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Soft gate */
.bv-soft-gate,
.bv-save-batch {
  padding: 22px 20px;
  border-radius: var(--bv-radius-sm);
  display: grid;
  gap: 10px;
  background: var(--ink);
  color: var(--white);
}

.bv-save-batch {
  background: var(--paper-dim);
  color: var(--ink);
}

.bv-soft-gate .bv-mono-label {
  color: color-mix(in srgb, var(--teal-soft) 90%, var(--white));
}

.bv-soft-gate h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--white);
}

.bv-soft-gate p {
  margin: 0;
  color: color-mix(in srgb, var(--white) 72%, transparent);
  font-size: 0.95rem;
  line-height: 1.45;
}

.bv-soft-gate .button-secondary {
  border-color: color-mix(in srgb, var(--white) 28%, transparent);
  color: var(--white);
  background: transparent;
}

.bv-soft-gate .button-secondary:hover {
  border-color: var(--white);
  background: color-mix(in srgb, var(--white) 10%, transparent);
}

.bv-save-batch-row {
  align-items: stretch;
}

.bv-select {
  flex: 1 1 180px;
  min-height: 44px;
}

.bv-save-status {
  margin: 0;
  color: var(--success-ink);
  font-size: 0.9rem;
}

/* —— Onboarding / forms ——————————————————————————————————————————————— */

.bv-onboard-form,
.bv-create-batch,
.bv-entry-form,
.bv-auth-panel {
  display: grid;
  gap: 14px;
  padding: 28px 24px;
  border-radius: var(--bv-radius);
  background: var(--surface);
  box-shadow: var(--bv-shadow-lg);
}

.bv-onboard-fields {
  display: grid;
  gap: 24px;
}

.bv-field {
  display: grid;
  gap: 10px;
}

.bv-field legend,
.bv-onboard-form label,
.bv-create-batch label,
.bv-entry-form label,
.bv-auth-form label {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
}

.bv-option-stack {
  display: grid;
  gap: 8px;
}

.bv-option-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 48px;
  padding: 14px 16px;
  border-radius: var(--bv-radius-sm);
  background: var(--paper-dim);
  border: 0;
  cursor: pointer;
  transition: background 160ms var(--bv-ease), box-shadow 160ms var(--bv-ease);
}

.bv-option-row:hover {
  background: color-mix(in srgb, var(--teal-soft) 40%, var(--paper-dim));
}

.bv-option-row:has(input:checked) {
  background: color-mix(in srgb, var(--teal-soft) 55%, var(--surface));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--teal) 40%, transparent);
}

.bv-option-row input {
  margin-top: 3px;
  accent-color: var(--teal);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.bv-option-row span {
  color: var(--ink-soft);
  line-height: 1.4;
}

.bv .form-input {
  min-height: 48px;
  background: var(--paper-dim);
  color: var(--ink);
  border: 0;
  border-radius: var(--bv-radius-sm);
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 160ms var(--bv-ease), background 160ms var(--bv-ease);
}

.bv .form-input:focus {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--teal) 45%, transparent);
}

.bv textarea.form-input {
  min-height: 96px;
  resize: vertical;
}

/* —— Brews ———————————————————————————————————————————————————————————— */

.bv-batch-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.bv-batch-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 20px 22px;
  text-align: left;
  border: 0;
  border-radius: var(--bv-radius);
  background: var(--surface);
  box-shadow: var(--bv-shadow);
  color: inherit;
  cursor: pointer;
  transition: transform 200ms var(--bv-ease), box-shadow 200ms var(--bv-ease);
}

.bv-batch-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--bv-shadow-lg);
}

.bv-batch-item-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.bv-batch-item-meta {
  color: var(--ink-mute);
  font-family: var(--font-text);
  font-size: 0.82rem;
  font-weight: 500;
}

.bv-brews-empty {
  margin: 0;
  padding: 32px 24px;
  text-align: center;
  border-radius: var(--bv-radius);
  background: var(--surface);
  box-shadow: var(--bv-shadow);
  color: var(--ink-mute);
  font-size: 0.98rem;
}

.bv-back {
  justify-self: start;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 500;
  font-size: 0.95rem;
}

.bv-entry-forms {
  display: grid;
  gap: 14px;
}

@media (min-width: 720px) {
  .bv-entry-forms {
    grid-template-columns: 1fr 1fr;
  }
}

.bv-entries-label {
  margin-top: 10px;
}

.bv-entry-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.bv-entry-item {
  padding: 16px 18px;
  border-radius: var(--bv-radius-sm);
  background: var(--surface);
  box-shadow: var(--bv-shadow);
  display: grid;
  gap: 4px;
}

.bv-entry-type {
  font-family: var(--font-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

.bv-entry-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.bv-entry-time {
  color: var(--ink-mute);
  font-size: 0.8rem;
}

/* —— Auth dialog —————————————————————————————————————————————————————— */

.bv-auth-dialog {
  width: min(100vw - 32px, 420px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--bv-radius);
  background: transparent;
  color: var(--ink);
}

.bv-auth-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
  backdrop-filter: blur(8px);
}

.bv-auth-close-row {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

.bv-dialog-close {
  position: relative;
  z-index: 2;
  min-height: 36px;
  min-width: 36px;
  margin: 12px 12px 0 0;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill, 980px);
  background: var(--paper-dim);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.84rem;
}

.bv-auth-panel {
  margin-top: -28px;
  box-shadow: var(--shadow-product, 0 32px 64px -24px rgba(0, 0, 0, 0.2));
}

.bv-auth-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bv-auth-lede,
.bv-oauth-note {
  margin: 0;
  color: var(--ink-mute);
  font-size: 0.9rem;
}

.bv-oauth-row {
  display: grid;
  gap: 8px;
}

.bv-oauth:disabled {
  opacity: 0.5;
}

.bv-auth-form {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

/* —— Companion panel + FAB ———————————————————————————————————————————— */

.bv-companion-panel {
  position: fixed;
  z-index: var(--bv-z-companion);
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(calc(100vw - 32px), 360px);
  border-radius: var(--bv-radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--bv-shadow-lg);
  overflow: hidden;
  transition: opacity 200ms var(--bv-ease), transform 200ms var(--bv-ease);
}

.bv-companion-panel.is-hidden-mode {
  display: none;
}

.bv-companion-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.bv-companion-toggle-label {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.bv-companion-toggle-hint {
  color: var(--ink-mute);
  font-size: 0.8rem;
}

.bv-companion-body {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
  max-height: min(52vh, 420px);
}

.bv-companion-body[hidden] {
  display: none !important;
}

.bv-companion-disclaimer {
  margin: 0;
  color: var(--ink-mute);
  font-size: 0.76rem;
  line-height: 1.4;
}

.bv-companion-messages {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.bv-chat-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 92%;
}

.bv-chat-bubble[data-role="user"] {
  justify-self: end;
  background: var(--teal);
  color: var(--white);
  border-radius: 16px 16px 4px 16px;
}

.bv-chat-bubble[data-role="assistant"] {
  justify-self: start;
  background: var(--paper-dim);
  color: var(--ink-soft);
  border-radius: 16px 16px 16px 4px;
}

.bv-companion-form {
  display: grid;
  gap: 8px;
}

.bv-companion-fab {
  position: fixed;
  z-index: var(--bv-z-fab);
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--teal) 40%, transparent);
  transition: transform 180ms var(--bv-ease), background 180ms var(--bv-ease);
}

.bv-companion-fab:hover {
  transform: scale(1.05);
  background: var(--teal-deep);
}

.bv-companion-fab[hidden] {
  display: none !important;
}

.bv-companion-panel.is-fab-open {
  display: block;
  bottom: calc(18px + 64px + env(safe-area-inset-bottom, 0px));
}

/* —— Toast ———————————————————————————————————————————————————————————— */

.bv-toast {
  position: fixed;
  z-index: var(--bv-z-toast);
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 14px 20px;
  border-radius: var(--radius-pill, 980px);
  background: var(--ink);
  color: var(--white);
  box-shadow: var(--bv-shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.bv-toast[hidden] {
  display: none !important;
}

/* —— Buttons —————————————————————————————————————————————————————————— */

.bv .button {
  min-height: 44px;
}

/* —— Reduced motion ——————————————————————————————————————————————————— */

@media (prefers-reduced-motion: reduce) {
  .bv-view.is-active,
  .bv-dropzone,
  .bv-batch-item,
  .bv-companion-panel,
  .bv-companion-fab,
  .bv-analyzing-fill {
    animation: none !important;
    transition: none !important;
  }

  .bv-analyzing-fill {
    width: 70%;
    transform: none;
  }
}

@media (max-width: 520px) {
  .bv {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 150px;
  }

  .bv-dropzone {
    min-height: 240px;
    padding: 28px 20px;
  }

  .bv-tip-list {
    flex-direction: column;
    align-items: stretch;
  }

  .bv-tip-list li {
    max-width: none;
    text-align: center;
  }

  .bv-companion-panel {
    left: 16px;
    right: 16px;
    width: auto;
  }

  .bv-save-batch-row {
    flex-direction: column;
  }

  .bv-analyze-btn {
    width: 100%;
  }
}
