/* Breederly 2.0 — final UI normalization layer.
   Loaded after app.css so every product surface shares the same controls,
   touch targets and responsive behavior without page-specific drift. */
:root{
  --br-ui-control:44px;
  --br-ui-input:46px;
  --br-ui-radius:11px;
  --br-ui-card:16px;
  --br-ui-page:1420px;
}
body.breederly-app-page{margin:0;overflow-x:hidden;background:var(--br-bg);color:var(--br-text)}
body.breederly-app-page.br-modal-open{overflow:hidden}
.br-app-shell,.br-flow-shell,.br-book-shell,.br-auth-shell,.br-gate,.br-discover{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
.br-app-shell *,.br-flow-shell *,.br-book-shell *,.br-auth-shell *,.br-gate *,.br-discover *{box-sizing:border-box}
.br-app-main,.br-app-content,.br-card,.br-page-head,.br-page-actions,.br-filterbar,.br-messages,.br-editor,.br-flow-card,.br-book-card{min-width:0}

/* Controls */
.br-btn{height:auto!important;min-height:var(--br-ui-control)!important;max-height:none!important;padding:10px 15px!important;border-radius:var(--br-ui-radius)!important;border-width:1px!important;font-size:12px!important;font-weight:780!important;line-height:1.2!important;white-space:normal;box-shadow:none!important;transform:none!important;touch-action:manipulation;text-align:center}
.br-btn--small{height:auto!important;min-height:36px!important;max-height:none!important;padding:8px 11px!important;border-radius:9px!important;font-size:10px!important}
.br-btn:focus-visible,.br-icon-btn:focus-visible,.br-link-btn:focus-visible,.br-segmented button:focus-visible,.br-favorite:focus-visible{outline:2px solid var(--br-brand);outline-offset:2px}
.br-btn:disabled,.br-btn[aria-disabled="true"]{opacity:.48!important;cursor:not-allowed!important;pointer-events:none!important}
@media(hover:hover) and (pointer:fine){.br-btn:not(:disabled):hover{transform:translateY(-1px)!important}}
.br-icon-btn{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;border-radius:var(--br-ui-radius)!important;touch-action:manipulation}
.br-link-btn{min-height:40px!important;padding:0 10px!important;border-radius:9px!important;display:inline-flex;align-items:center;justify-content:center}
.br-topbar-link{min-height:44px!important;border-radius:var(--br-ui-radius)!important}
.br-app-nav a{min-height:44px!important;border-radius:10px!important}
.br-sidebar-bottom a{min-height:42px!important;display:flex;align-items:center}
.br-segmented button{min-height:38px;touch-action:manipulation}
.br-field input:not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]),
.br-field select,.br-search input{height:var(--br-ui-input)!important;min-height:var(--br-ui-input)!important;border-radius:var(--br-ui-radius)!important;font-size:16px!important}
.br-field textarea,.br-chat-form textarea{min-height:92px;border-radius:var(--br-ui-radius)!important;font-size:16px!important;line-height:1.5!important}
.br-chat-form textarea{min-height:46px!important}
.br-field input[readonly]{background:#f7f7f4!important;color:#72736f!important}
.br-checkbox a{font-weight:800;text-decoration:underline;text-underline-offset:2px}

/* Shared dashboard shell */
.br-app-shell{min-height:100dvh;display:grid;grid-template-columns:244px minmax(0,1fr);background:var(--br-bg)}
.br-app-sidebar{height:100dvh;position:sticky;top:0;padding:18px 12px 14px;background:#fff;border-right:1px solid var(--br-line);box-shadow:none}
.br-account-switch{min-height:64px;margin:0 0 12px;padding:10px;border:1px solid var(--br-line);border-radius:13px;background:#fbfbf9}
.br-app-topbar{min-height:68px;padding:10px clamp(16px,3vw,34px);position:sticky;top:0;z-index:80;background:rgba(247,246,242,.95);border-bottom:1px solid rgba(226,225,220,.9);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
.br-app-content{width:min(var(--br-ui-page),100%);max-width:none;margin:0 auto;padding:32px clamp(18px,3.7vw,48px) 76px}
.br-card,.br-stat,.br-family-case,.br-payment-card,.br-public-card,.br-saved-card{border-radius:var(--br-ui-card)!important}
.br-page-head{align-items:flex-end;margin-bottom:22px}.br-page-head h1{font-size:clamp(29px,3vw,36px);line-height:1.03}.br-page-head p{max-width:720px;font-size:13px;line-height:1.6}
.br-page-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px}

/* Focused flows remain part of the family dashboard once logged in. */
.br-flow-card--embedded{width:100%;max-width:none;margin:0;min-height:620px;box-shadow:var(--br-shadow)}
.br-flow-card--embedded .br-flow-side{border-radius:0}
.br-flow-brand{display:none}
.br-book-card--embedded{width:100%;max-width:none;margin:0}

/* Auth is deliberately calm and fast on small screens. */
.br-auth-aside{background:radial-gradient(circle at 78% 16%,rgba(255,255,255,.12),transparent 26%),linear-gradient(145deg,#354139,#18201b)!important}
.br-flow-side{background:radial-gradient(circle at 78% 18%,rgba(255,255,255,.11),transparent 25%),linear-gradient(155deg,#344139,#19221c)!important}
.br-puppy-image{background:linear-gradient(145deg,#d9ded7,#b5beb7)!important}
.br-puppy-image.has-image{background-image:linear-gradient(180deg,rgba(12,16,13,.02),rgba(12,16,13,.18)),var(--br-puppy-image)!important;background-size:cover!important;background-position:center!important}
.br-family-hero{background:linear-gradient(135deg,#202923,#465249)!important}

/* CRM and portal: no desktop table assumptions on touch layouts. */
.br-crm-list,.br-family-case-list,.br-payment-grid,.br-booking-list,.br-application-list{width:100%}
.br-messages{max-width:100%}.br-chat-form{min-width:0}.br-chat-form textarea{min-width:0;flex:1}
.br-portal-layout,.br-family-dashboard-grid,.br-dashboard-grid,.br-calendar-layout,.br-editor{min-width:0}
.br-portal-list__row>*{min-width:0}

@media(max-width:1050px){
  .br-dashboard-grid,.br-calendar-layout,.br-editor,.br-portal-layout,.br-family-dashboard-grid{grid-template-columns:1fr!important}
  .br-editor-preview{position:static!important}
}
@media(max-width:800px){
  .br-app-shell{display:block}
  .br-app-sidebar{position:fixed!important;left:0;top:0;bottom:0;width:min(86vw,310px);height:100dvh!important;z-index:1200;transform:translateX(-104%);transition:transform .2s ease;box-shadow:22px 0 60px rgba(0,0,0,.17)}
  .br-app-sidebar.is-open{transform:translateX(0)}
  .br-app-menu{display:grid!important}
  .br-app-topbar{min-height:62px;padding:8px 12px}
  .br-topbar-link{display:none!important}
  .br-topbar-avatar{width:44px!important;height:44px!important;border-radius:11px!important}
  .br-app-content{padding:22px 14px 102px}
  .br-page-head{align-items:flex-start!important;flex-direction:column!important;gap:14px}
  .br-page-actions{display:grid!important;grid-template-columns:1fr;width:100%}.br-page-actions>.br-btn,.br-page-actions>button{width:100%}
  .br-stat-grid,.br-stat-grid--3{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .br-profile-grid,.br-doc-grid,.br-discover-grid,.br-payment-grid{grid-template-columns:1fr!important}
  .br-filterbar{align-items:stretch!important;flex-direction:column!important}.br-search{width:100%;max-width:none!important;min-width:0!important}
  .br-flow-card,.br-book-card{grid-template-columns:1fr!important;min-height:0}.br-flow-side{min-height:220px}.br-flow-form,.br-book-card>.br-form,.br-book-availability{padding:24px 20px!important}
  .br-messages{height:auto!important;min-height:calc(100dvh - 178px);grid-template-columns:1fr!important}
  .br-messages>aside{display:flex!important;gap:8px;overflow-x:auto;padding:10px;border-right:0!important;border-bottom:1px solid var(--br-line);scroll-snap-type:x proximity;scrollbar-width:none}.br-messages>aside::-webkit-scrollbar{display:none}.br-messages>aside .br-search{display:none}
  .br-message-person,.br-message-person:not(.is-active){display:grid!important;flex:0 0 200px;min-width:200px;width:200px;border:1px solid var(--br-line)!important;scroll-snap-align:start}.br-message-person.is-active{border-color:var(--br-line-strong)!important}
  .br-chat>div{max-width:86%}
  .br-family-current,.br-family-start,.br-family-case-hero{grid-template-columns:1fr!important}
  .br-breeder-mobile-nav,.br-family-mobile-nav{padding-bottom:max(5px,env(safe-area-inset-bottom))}
}
@media(max-width:640px){
  .br-app-content{padding-left:12px;padding-right:12px}
  .br-card{padding:17px}.br-card--flush{padding:0}
  .br-form-grid,.br-choice-grid{grid-template-columns:1fr!important}
  .br-button-row{display:grid!important;grid-template-columns:1fr;width:100%}.br-button-row>.br-btn{width:100%}
  .br-stat-grid,.br-stat-grid--3{gap:9px}
  .br-family-current,.br-family-start{padding:23px 18px!important;border-radius:17px!important}.br-family-current h2,.br-family-start h2{font-size:34px!important}
  .br-family-case__foot{align-items:flex-start!important;flex-direction:column!important}.br-family-case__foot .br-button-row{width:100%}
  .br-puppy-hero--portal{grid-template-columns:1fr!important}.br-puppy-hero--portal .br-puppy-image{min-height:310px}
  .br-portal-aside{grid-template-columns:1fr!important}.br-portal-aside>section:first-child{grid-column:auto!important}
  .br-flow-form,.br-book-card>.br-form,.br-book-availability{padding:22px 18px!important}
  .br-flow-actions{display:grid!important;grid-template-columns:1fr!important}.br-flow-actions .br-btn{width:100%}
  .br-auth-shell{margin:8px!important;border-radius:17px!important}.br-auth-card{padding:28px 18px!important}.br-auth-aside{display:none!important}
  .br-modal{padding:0!important}.br-modal-card{align-self:end;width:100%!important;max-height:92dvh;border-radius:20px 20px 0 0!important;padding:18px!important;padding-bottom:max(18px,env(safe-area-inset-bottom))!important}
}
@media(max-width:390px){
  .br-stat-grid,.br-stat-grid--3,.br-family-quick-grid{grid-template-columns:1fr!important}
  .br-case-progress{grid-template-columns:1fr 1fr!important}
  .br-puppy-stats{grid-template-columns:1fr 1fr!important}
}

/* WordPress chrome must never leak into the Breederly customer app. */
body.breederly-app-page #wpadminbar{display:none!important}
body.breederly-app-page.admin-bar{margin-top:0!important;padding-top:0!important}
@media screen and (max-width:782px){body.breederly-app-page.admin-bar{margin-top:0!important;padding-top:0!important}}

/* Destructive actions stay visually distinct without changing the core control system. */
.br-btn--danger{background:#fff!important;color:#9c2f2f!important;border-color:#e7caca!important}
.br-btn--danger:hover{background:#fff7f7!important;border-color:#d9aaaa!important;color:#7d2222!important}
.br-danger-zone{margin-top:18px;padding-top:18px;border-top:1px solid #eee3e3}
.br-danger-zone p{margin:0 0 12px;color:#7a6666;font-size:12px;line-height:1.55}
.br-inline-note{margin-top:14px;padding:12px 14px;border-radius:10px;background:#f5f4f0;color:var(--br-muted);font-size:12px;line-height:1.5}
.br-puppy-admin-card__body>.br-link-btn{margin-top:-2px;margin-bottom:6px;padding-left:0!important;justify-content:flex-start!important}

/* v2.2 frontend isolation: WordPress chrome must never enter Breederly product UI. */
html { margin-top: 0 !important; }
#wpadminbar { display: none !important; }
body.admin-bar { margin-top: 0 !important; }
@media screen and (max-width: 782px) {
  html { margin-top: 0 !important; }
}
