/* Shared controls. Specificity is bounded to the UI scope plus one component.
   Export canvases keep their original artwork and are excluded from this theme. */
.mb-toast { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 99999; max-width: calc(100vw - 32px); padding: .9rem 1.4rem; border: 1px solid #c4ddcd; border-radius: var(--mb-control-radius); background: var(--mb-brand); color: white; font-size: .9rem; font-weight: 700; line-height: 1.6; text-align: center; overflow-wrap: anywhere; box-shadow: 0 8px 28px #26372f24; pointer-events: none; }
.mb-toast[data-tone="warn"] { background: var(--mb-danger); border-color: #edcbd0; }
.mb-ui:is(.mb-page,.mb-overlay) { color: var(--mb-ink); --mb-copy: var(--mb-ink); }
.mb-ui:is(.mb-page,.mb-overlay) :where(h1,h2,h3,h4) { color: var(--mb-ink); letter-spacing: -.035em; text-wrap: balance; }
.mb-ui:is(.mb-page,.mb-overlay) :where(p,label,li) { overflow-wrap: anywhere; }
.mb-ui:is(.mb-page,.mb-overlay) :where(button,[role="button"]) { min-height: 44px; line-height: 1.4; transition: background-color .18s, border-color .18s, box-shadow .18s; }
.mb-ui .text-transparent { color: var(--mb-ink); background-image: none; -webkit-text-fill-color: currentColor; }
.mb-ui :is(.text-xs,.text-\[10px\],.text-\[11px\]) { font-size: var(--mb-copy-small,.8125rem); line-height: 1.6; }
.mb-overlay.bg-slate-900 { background: var(--mb-paper); }
.mb-ui:is(.mb-page,.mb-overlay) :where(button:disabled) { cursor: not-allowed; opacity: .5; }
.mb-ui:is(.mb-page,.mb-overlay) :where(button,a,input,textarea,select):focus-visible { outline: 3px solid var(--mb-mint); outline-offset: 3px; }
.mb-ui:is(.mb-page,.mb-overlay) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),textarea,select) {
  background: var(--mb-surface); color: var(--mb-ink); border: 1px solid var(--mb-line);
  border-radius: var(--mb-control-radius); padding: .8rem 1rem; min-height: 46px;
}
.mb-ui:is(.mb-page,.mb-overlay) :where(input,textarea)::placeholder { color: #7e8b81; }
.mb-ui:is(.mb-page,.mb-overlay) :where(input[type="checkbox"],input[type="radio"]) { accent-color: var(--mb-brand); }
.mb-ui:is(.mb-page,.mb-overlay) :where(select option) { background: white; color: var(--mb-ink); }
.mb-ui:is(.mb-page,.mb-overlay) :where(.card-transition,.community-card) { border: 1px solid var(--mb-line); border-radius: var(--mb-radius); box-shadow: var(--mb-shadow); }
.mb-ui:is(.mb-page,.mb-overlay) :where(.card-transition:hover,.community-card:hover) { border-color: #a8c5b0; }
.mb-ui:is(.mb-page,.mb-overlay) :where(.primary-hub-back) { display: inline-flex; align-items: center; gap: .5rem; padding: .65rem 1rem; background: white; border: 1px solid var(--mb-line); border-radius: var(--mb-control-radius); font-weight: 700; }
.mb-ui:is(.mb-page,.mb-overlay) :where(.primary-hub-eyebrow) { color: var(--mb-brand); font-size: .8rem; letter-spacing: .13em; font-weight: 800; margin: 1.75rem 0 .75rem; }
.mb-ui:is(.mb-page,.mb-overlay) :where(.primary-hub-lead) { max-width: 58ch; color: var(--mb-muted); font-size: 1.1rem; margin: 1rem 0 2rem; }
.mb-ui:is(.mb-page,.mb-overlay) :where(.primary-hub-card) { display: flex; flex-direction: column; align-items: start; gap: .75rem; padding: 1.75rem; text-align: left; background: white; border: 1px solid var(--mb-line); border-radius: var(--mb-radius); }
.mb-ui:is(.mb-page,.mb-overlay) :where(.primary-hub-card strong) { color: var(--mb-ink); font-size: 1.25rem; }
.mb-ui:is(.mb-page,.mb-overlay) :where(.primary-hub-card span) { color: var(--mb-muted); }
.mb-ui .mb-dialog-panel { max-height: min(90dvh, 960px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 24px 80px #26372f30; border-radius: 24px; border-color: var(--mb-line); }
#modalAuthLogin .mb-dialog-panel { display: flex; flex-direction: column; }
#modalAuthLogin .mb-dialog-close { position: sticky; top: .5rem; z-index: 2; align-self: flex-end; margin-bottom: -3rem; }
.mb-ui .mb-info-note { background: var(--mb-info-soft); border-color: color-mix(in srgb, var(--mb-info) 34%, var(--mb-line)); color: var(--mb-info); }
.mb-ui .mb-info-note > :first-child { color: var(--mb-info); }
.mb-ui .mb-info-note p { color: var(--mb-text-secondary); }
.mb-overlay :where(h3,h4) { line-height: 1.4; }
.mb-overlay[hidden] { display: none; }

/* Page navigation is independent of title length in either language. */
.mb-ui .mb-page-header { display: grid; grid-template-columns: minmax(0,1fr); align-items: start; justify-items: stretch; gap: 1.35rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--mb-line); }
.mb-ui .mb-page-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.mb-ui .mb-back { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; justify-self: start; align-self: start; gap: .5rem; width: max-content; max-width: 100%; min-height: 44px; white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.mb-ui .mb-back :is(span,svg,i) { flex-shrink: 0; white-space: nowrap; overflow-wrap: normal; }
.mb-ui .mb-page-heading { min-width: 0; text-align: left; }
.mb-ui .mb-page-heading :is(h1,h2), .mb-ui h1.mb-page-heading { justify-content: flex-start; align-items: flex-start; gap: .65rem; margin: 0; font-size: var(--mb-copy-title,clamp(1.6rem,3.2vw,2.65rem)); line-height: 1.35; white-space: normal; overflow: visible; text-overflow: clip; }
.mb-ui .mb-page-heading :is(h1,h2) > :is(i,svg) { flex-shrink: 0; width: 1.3rem; height: 1.3rem; margin-top: .35em; }
.mb-ui .mb-page-heading :is(h1,h2) > span { min-width: 0; overflow-wrap: anywhere; }
.mb-ui .mb-page-heading p:not(.primary-hub-eyebrow) { max-width: 62ch; margin-top: .8rem; margin-bottom: 0; color: var(--mb-muted); font-size: 1rem; line-height: 1.75; white-space: normal; overflow: visible; text-overflow: clip; }
.mb-ui .mb-page-heading .primary-hub-eyebrow { margin-top: 0; }

/* Tabs retain whole labels and scroll horizontally; actions can wrap as a group. */
.mb-ui .mb-tabs { flex-wrap: nowrap; gap: .5rem; max-width: 100%; min-width: 0; overflow-x: auto; padding: .3rem .2rem .65rem; scroll-padding-inline: .2rem; overscroll-behavior-inline: contain; }
.mb-ui .mb-tabs:not(.hidden) { display: flex; }
.mb-ui .mb-tabs > button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: .4rem; min-width: max-content; min-height: 44px; padding-inline: 1rem; white-space: nowrap; word-break: normal; }
.mb-ui .mb-tabs > button :is(span,svg) { flex-shrink: 0; white-space: nowrap; }
.mb-ui .mb-actions { align-items: stretch; flex-wrap: wrap; gap: .75rem; }
.mb-ui .mb-actions:not(.hidden) { display: flex; }
.mb-ui .mb-actions > button { flex: 1 1 12rem; min-width: 0; padding: .8rem 1rem; text-align: center; white-space: normal; }
.mb-ui .mb-actions > button:only-child { flex-grow: 0; }
.mb-ui .mb-actions > .mb-back { flex: 0 0 auto; width: max-content; white-space: nowrap; }
.mb-ui .mb-dialog-panel button[aria-label] { min-width: 44px; flex-shrink: 0; }
.mb-ui .mb-dialog-close { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.mb-ui .mb-dialog-panel > .absolute + .text-center { padding-inline: 1.75rem; }

/* Common action button hierarchy and notices */
/* Shared workspaces opt into readable type; brand/editorial/report artwork stays unchanged. */
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) {
  --mb-copy-title: var(--mb-type-title); --mb-copy-small: var(--mb-type-small);
  --mb-muted: var(--mb-text-secondary);
  font-size: var(--mb-type-body); line-height: 1.75;
}
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(p[class],li[class]):not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *)){
  font-size: var(--mb-type-body); line-height: 1.8;
}
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(label[class],label):not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *)){
  font-size: var(--mb-type-label); font-weight: 650; line-height: 1.6;
}
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(input[class]:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),select[class],textarea[class],button[class]):not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *)){
  font-size: var(--mb-type-control); line-height: 1.5; min-height: 48px;
}
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(input,textarea):not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *))::placeholder {
  color: var(--mb-text-placeholder); opacity: 1; font-size: var(--mb-type-control);
}
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(p[class],span[class])[data-i18n*="hint"]:not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *)),
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(p[class],span[class])[data-i18n*="note"]:not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *)) {
  font-size: var(--mb-type-help); line-height: 1.75;
}
.mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) :is(button,label) :is(span[class],span):not(:where([id$="CaptureArea"], [id$="CaptureArea"] *, #sharePreviewCard, #sharePreviewCard *, #relationshipPreviewCard, #relationshipPreviewCard *)){
  font-size: inherit; line-height: inherit;
}
/* Preview/export artwork keeps its previous inherited type and colour values. */
.mb-ui :is([id$="CaptureArea"],#sharePreviewCard,#relationshipPreviewCard) { --mb-copy-small: .8125rem; --mb-muted: #64746b; font-size: 17px; line-height: 1.65; }
.mb-ui .mb-section-title { font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 800; color: var(--mb-ink); letter-spacing: -.025em; line-height: 1.45; }
.mb-ui .mb-btn-primary { min-height: 48px; padding: .75rem 1.5rem; border-radius: var(--mb-control-radius); background: var(--mb-brand); color: white; font-size: .95rem; font-weight: 800; border: 0; box-shadow: 0 4px 14px rgba(52, 121, 91, .2); display: inline-flex; align-items: center; justify-content: center; gap: .5rem; transition: background-color .18s, transform .18s; }
.mb-ui .mb-btn-primary:hover { background: var(--mb-brand-hover); }
.mb-ui .mb-btn-secondary { min-height: 44px; padding: .65rem 1.25rem; border-radius: var(--mb-control-radius); background: var(--mb-surface); color: var(--mb-ink); font-size: .9rem; font-weight: 700; border: 1px solid var(--mb-line); display: inline-flex; align-items: center; justify-content: center; gap: .5rem; transition: all .18s; }
.mb-ui .mb-btn-secondary:hover { background: var(--mb-soft); border-color: var(--mb-mint); color: var(--mb-brand); }
.mb-ui .mb-notice-box { padding: 1rem 1.25rem; border-radius: var(--mb-control-radius); font-size: .875rem; line-height: 1.7; border: 1px solid transparent; }
.mb-ui .mb-notice-box--amber { background: #fffbf2; border-color: #f2dec0; color: #8a5a22; }
.mb-ui .mb-notice-box--emerald { background: var(--mb-brand-soft); border-color: #cbe3d3; color: var(--mb-brand-hover); }

/* A state is content, not a completed report. Existing JS owns visibility. */
.mb-ui .mb-state { width: 100%; padding: clamp(1.75rem,5vw,3rem); text-align: center; border: 1px dashed var(--mb-line); border-radius: var(--mb-radius); background: var(--mb-surface); box-shadow: none; }
.mb-ui .mb-state:not(.hidden) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; min-height: 16rem; }
.mb-ui .mb-state p { max-width: 48ch; margin-inline: auto; font-size: 1rem; line-height: 1.75; }
.mb-ui .mb-state--loading { border: 0; background: transparent; }
.mb-ui .mb-state--error { border-style: solid; border-color: #edcbd0; }
.mb-ui .mb-state.mb-state--inline { min-height: 0; padding: 1rem 1.25rem; text-align: left; }
.mb-ui .mb-state--inline:not(.hidden) { flex-direction: row; justify-content: flex-start; }
.mb-ui .mb-state--inline p { margin: 0; }
@media(max-width: 768px) {
  .mb-overlay { padding: .75rem; }
  .mb-ui:is(.mb-page,.mb-overlay) :where(input,select,textarea) { font-size: 16px; }
  .mb-ui .mb-page-header { gap: 1rem; padding-bottom: 1.25rem; }
  .mb-ui .mb-page-heading :is(h1,h2) { font-size: var(--mb-copy-title,clamp(1.55rem,6vw,2rem)); }
  .mb-ui:where(.mb-page--workbench,#screen-personality-history,#screen-life,#screen-care) { --mb-copy-title: clamp(1.5rem,6vw,1.75rem); }
  .mb-ui .mb-state:not(.hidden) { min-height: 13rem; }
  .mb-ui .mb-state.mb-state--inline { min-height: 0; }
  .mb-ui .mb-actions > button { flex-basis: 100%; }
}

/* Reserve icon space after the common input padding rule, including edit modals. */
.mb-ui:is(.mb-page,.mb-overlay) .breed-search-scope input[type="text"] {
  padding-inline: 2.5rem 2.75rem;
  min-width: 0;
  line-height: 1.6;
}
.mb-ui .mb-registration-breed-options { min-width: 0; }
.mb-ui .mb-registration-breed-unknown { min-width: 0; white-space: nowrap; overflow-wrap: normal; }
.mb-ui .mb-registration-breed-unknown[aria-pressed="true"] { background: var(--mb-info-soft); color: var(--mb-info); border-color: var(--mb-info); }
.mb-ui .mb-registration-breed-unknown:not([aria-pressed="true"]) { background: var(--mb-surface); color: var(--mb-text-secondary); border-color: var(--mb-line); }
.mb-ui .mb-registration-breed-unknown:hover { background: var(--mb-info-soft); border-color: var(--mb-info); }
@media (max-width: 350px) {
  .mb-ui .mb-registration-breed-options { flex-direction: column; }
  .mb-ui .mb-registration-breed-options > button { width: 100%; }
}
.mb-ui .breed-search-scope > .relative > button { width: 2.5rem; right: 0; }
.mb-ui .mb-registration-recovery { padding: 1rem; border: 1px solid var(--mb-line); border-radius: var(--mb-control-radius); }
.mb-ui .mb-registration-recovery button { margin: .5rem .5rem 0 0; padding: .5rem 1rem; border: 1px solid var(--mb-line); border-radius: var(--mb-control-radius); }
