/*
 * AF-Health
 * Professional Frontend UI Refinement Layer
 *
 * Loaded after the theme experience files and before administrator-saved
 * theme customization. This keeps all ten identities intact while giving
 * public pages and non-admin portals a consistent production-grade UI system.
 */

/* --------------------------------------------------------------------------
   1. Professional design contract
   -------------------------------------------------------------------------- */
body[class*="frontend-theme-"]:not(.role-admin){
  --pro-container:1240px;
  --pro-reading:72ch;
  --pro-line:color-mix(in srgb,var(--border) 88%,transparent);
  --pro-line-strong:color-mix(in srgb,var(--primary) 24%,var(--border));
  --pro-soft:color-mix(in srgb,var(--primary-soft) 38%,var(--surface));
  --pro-raised:color-mix(in srgb,var(--surface) 95%,var(--primary-soft) 5%);
  --pro-shadow-xs:0 1px 2px rgba(15,35,63,.035),0 4px 12px rgba(15,35,63,.035);
  --pro-shadow-sm:0 8px 24px rgba(15,35,63,.07),0 2px 8px rgba(15,35,63,.035);
  --pro-shadow-md:0 18px 48px rgba(15,35,63,.09),0 5px 16px rgba(15,35,63,.045);
  --pro-shadow-lg:0 28px 72px rgba(15,35,63,.12),0 8px 26px rgba(15,35,63,.055);
  --pro-focus:color-mix(in srgb,var(--primary) 34%,transparent);
  --pro-hover-border:color-mix(in srgb,var(--primary) 34%,var(--border));
  --pro-transition:160ms cubic-bezier(.2,.8,.2,1);
  --pro-section-space:clamp(64px,7vw,104px);
  --pro-card-pad:clamp(20px,2.2vw,30px);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

html[data-theme="dark"] body[class*="frontend-theme-"]:not(.role-admin){
  --pro-line:color-mix(in srgb,var(--border) 92%,transparent);
  --pro-soft:color-mix(in srgb,var(--primary-soft) 30%,var(--surface));
  --pro-raised:color-mix(in srgb,var(--surface) 94%,white 6%);
  --pro-shadow-xs:0 1px 2px rgba(0,0,0,.18),0 4px 12px rgba(0,0,0,.12);
  --pro-shadow-sm:0 10px 28px rgba(0,0,0,.22),0 2px 8px rgba(0,0,0,.14);
  --pro-shadow-md:0 20px 52px rgba(0,0,0,.28),0 5px 18px rgba(0,0,0,.18);
  --pro-shadow-lg:0 30px 80px rgba(0,0,0,.34),0 8px 28px rgba(0,0,0,.2);
}

body[class*="frontend-theme-"]:not(.role-admin) .container{
  width:min(var(--pro-container),calc(100% - clamp(32px,5vw,72px)));
}

body[class*="frontend-theme-"]:not(.role-admin) :where(h1,h2,h3,h4){
  text-wrap:balance;
  font-kerning:normal;
}

body[class*="frontend-theme-"]:not(.role-admin) :where(p,li,dd,.intro){
  text-wrap:pretty;
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.section-heading,.page-heading,.page-header,.auth-card .intro) p{
  max-width:var(--pro-reading);
}

body[class*="frontend-theme-"]:not(.role-admin) :where(a,button,input,select,textarea,[tabindex]):focus-visible{
  outline:3px solid var(--pro-focus);
  outline-offset:3px;
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.btn,.icon-button,.public-menu-toggle,.tab-button,.clinical-tab,.side-nav a){
  -webkit-tap-highlight-color:transparent;
}

/* --------------------------------------------------------------------------
   2. Controls, forms, and status surfaces
   -------------------------------------------------------------------------- */
body[class*="frontend-theme-"]:not(.role-admin) .btn{
  min-height:44px;
  padding:10px 17px;
  border-radius:var(--theme-button-radius,12px);
  border-color:transparent;
  font-weight:760;
  line-height:1.2;
  letter-spacing:-.01em;
  box-shadow:none;
  transition:transform var(--pro-transition),box-shadow var(--pro-transition),border-color var(--pro-transition),background-color var(--pro-transition),color var(--pro-transition);
}

body[class*="frontend-theme-"]:not(.role-admin) .btn-primary{
  background:var(--primary);
  color:var(--theme-on-primary,#fff);
  box-shadow:0 8px 20px color-mix(in srgb,var(--primary) 22%,transparent);
}

body[class*="frontend-theme-"]:not(.role-admin) .btn-primary:hover{
  background:var(--primary-strong);
  color:var(--theme-on-primary,#fff);
  box-shadow:0 12px 26px color-mix(in srgb,var(--primary) 25%,transparent);
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.btn-outline,.icon-button,.public-menu-toggle){
  border:1px solid var(--pro-line);
  background:color-mix(in srgb,var(--surface) 94%,transparent);
  color:var(--text);
  box-shadow:var(--pro-shadow-xs);
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.btn-outline,.icon-button,.public-menu-toggle):hover{
  border-color:var(--pro-hover-border);
  background:var(--surface);
  color:var(--primary-strong);
}

body[class*="frontend-theme-"]:not(.role-admin) .btn-ghost{
  color:var(--text);
  background:transparent;
}

body[class*="frontend-theme-"]:not(.role-admin) .btn-ghost:hover{
  background:var(--pro-soft);
  color:var(--primary-strong);
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.input,.select,.textarea,input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea){
  min-height:46px;
  border:1px solid var(--pro-line);
  border-radius:var(--theme-control-radius,12px);
  background:var(--surface);
  color:var(--text);
  box-shadow:inset 0 1px 0 color-mix(in srgb,#fff 45%,transparent);
  transition:border-color var(--pro-transition),box-shadow var(--pro-transition),background-color var(--pro-transition);
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.input,.select,.textarea,input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea):focus{
  border-color:color-mix(in srgb,var(--primary) 58%,var(--border));
  box-shadow:0 0 0 4px var(--pro-focus);
  outline:0;
}

body[class*="frontend-theme-"]:not(.role-admin) :where(label,.field-label,.form-label){
  color:color-mix(in srgb,var(--text) 88%,var(--muted));
  font-weight:700;
}

body[class*="frontend-theme-"]:not(.role-admin) :where(.badge,.status-badge,.pill){
  border:1px solid color-mix(in srgb,currentColor 14%,transparent);
  font-weight:760;
  letter-spacing:.01em;
}

/* --------------------------------------------------------------------------
   3. Public navigation and trust layer
   -------------------------------------------------------------------------- */
body.guest-shell[class*="frontend-theme-"] .public-trust-bar{
  min-height:34px;
  border-bottom:1px solid color-mix(in srgb,#fff 9%,transparent);
  font-size:.72rem;
  font-weight:650;
  letter-spacing:.01em;
}

body.guest-shell[class*="frontend-theme-"] .public-trust-bar .container{
  min-height:34px;
  height:auto;
  padding-block:7px;
}

body.guest-shell[class*="frontend-theme-"] .public-header{
  border-bottom:1px solid color-mix(in srgb,var(--border) 76%,transparent);
  box-shadow:0 8px 28px rgba(15,35,63,.045);
}

body.guest-shell[class*="frontend-theme-"] .public-nav{
  min-height:74px;
  height:auto;
  padding-block:10px;
  gap:clamp(16px,2.2vw,30px);
}

body.guest-shell[class*="frontend-theme-"] .public-nav .brand{
  min-width:max-content;
}

body.guest-shell[class*="frontend-theme-"] .public-nav .brand img{
  width:42px;
  height:42px;
  filter:drop-shadow(0 6px 12px color-mix(in srgb,var(--primary) 12%,transparent));
}

body.guest-shell[class*="frontend-theme-"] .brand-copy{
  letter-spacing:-.025em;
}

body.guest-shell[class*="frontend-theme-"] .brand-copy small{
  margin-top:5px;
  font-size:.64rem;
  letter-spacing:.14em;
  font-weight:760;
}

body.guest-shell[class*="frontend-theme-"] .public-links{
  gap:4px;
  padding:4px;
}

body.guest-shell[class*="frontend-theme-"] .public-links a{
  position:relative;
  min-height:40px;
  display:inline-flex;
  align-items:center;
  padding:9px 11px;
  border-radius:var(--theme-control-radius,12px);
  color:color-mix(in srgb,var(--text) 90%,var(--muted));
  font-size:.85rem;
  font-weight:690;
  transition:background-color var(--pro-transition),color var(--pro-transition),transform var(--pro-transition);
}

body.guest-shell[class*="frontend-theme-"] .public-links a:hover{
  background:var(--pro-soft);
  color:var(--primary-strong);
}

body.guest-shell[class*="frontend-theme-"] .public-actions{
  gap:8px;
}

body.guest-shell[class*="frontend-theme-"] .public-actions :where(.icon-button,.btn){
  min-height:42px;
}

/* --------------------------------------------------------------------------
   4. Homepage hierarchy and premium section rhythm
   -------------------------------------------------------------------------- */
body.guest-shell[class*="frontend-theme-"] .public-main{
  min-height:52vh;
}

body.guest-shell[class*="frontend-theme-"] :where(.section,.home-provider-finder,.home-doctor-specialties,.marketplace-home-section,.public-page-managed-html,.product-cta){
  scroll-margin-top:110px;
}

body.guest-shell[class*="frontend-theme-"] :where(.section-heading,.home-section-heading,.marketplace-home-heading) h2{
  line-height:1.08;
  letter-spacing:-.045em;
}

body.guest-shell[class*="frontend-theme-"] :where(.section-heading,.home-section-heading,.marketplace-home-heading) p{
  color:var(--muted);
  line-height:1.72;
}

body.guest-shell[class*="frontend-theme-"].route-home :where(
  .home-provider-finder-panel,
  .home-doctor-specialties-panel,
  .marketplace-home-panel,
  .provider-directory-managed-html__surface,
  .public-page-managed-html__surface
){
  border:1px solid var(--pro-line);
  box-shadow:var(--pro-shadow-sm);
}

body.guest-shell[class*="frontend-theme-"].route-home :where(
  .home-provider-finder-card,
  .home-doctor-specialty-card,
  .home-doctor-condition-card,
  .feature-card-premium,
  .marketplace-provider-card-v2,
  .temporary-provider-card
){
  border-color:var(--pro-line);
  box-shadow:var(--pro-shadow-xs);
  transition:transform var(--pro-transition),box-shadow var(--pro-transition),border-color var(--pro-transition),background-color var(--pro-transition);
}

/* Keep discovery layouts visually expressive but operationally scannable. */
body.guest-shell[class*="frontend-theme-"].route-home :where(
  .home-provider-finder-card,
  .home-doctor-specialty-card,
  .home-doctor-condition-card,
  .feature-card-premium
){
  margin-top:0!important;
  transform:none!important;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.metric-card-pro,.doctor-dashboard-metric){
  transform:none!important;
}

@media (hover:hover) and (pointer:fine){
  body.guest-shell[class*="frontend-theme-"].route-home :where(
    .home-provider-finder-card,
    .home-doctor-specialty-card,
    .home-doctor-condition-card,
    .feature-card-premium,
    .marketplace-provider-card-v2,
    .temporary-provider-card
  ):hover{
    transform:translateY(-3px)!important;
    border-color:var(--pro-hover-border);
    box-shadow:var(--pro-shadow-md);
  }
}

body.guest-shell[class*="frontend-theme-"].route-home :where(
  .home-provider-finder-card,
  .home-doctor-specialty-card,
  .home-doctor-condition-card,
  .feature-card-premium
) :where(h3,strong){
  color:var(--text);
  letter-spacing:-.02em;
}

body.guest-shell[class*="frontend-theme-"].route-home :where(
  .home-provider-finder-card,
  .home-doctor-specialty-card,
  .home-doctor-condition-card,
  .feature-card-premium
) :where(p,small,em){
  line-height:1.58;
}

body.guest-shell[class*="frontend-theme-"] .product-cta-panel{
  border:1px solid color-mix(in srgb,#fff 16%,transparent);
  box-shadow:var(--pro-shadow-lg);
}

/* --------------------------------------------------------------------------
   5. Directory, marketplace, auth, and content pages
   -------------------------------------------------------------------------- */
body.guest-shell[class*="frontend-theme-"] :where(
  .card,
  .auth-card,
  .provider-card,
  .directory-card,
  .temporary-capability-card,
  .temporary-search-card,
  .marketplace-registration-panel,
  .registration-form-card,
  .signup-form-surface,
  .promo-card,
  .faq-item
){
  border-color:var(--pro-line);
  box-shadow:var(--pro-shadow-sm);
}

body.guest-shell[class*="frontend-theme-"] .auth-wrap{
  padding-block:clamp(44px,7vw,84px);
}

body.guest-shell[class*="frontend-theme-"] .auth-card{
  padding:clamp(24px,4vw,38px);
}

body.guest-shell[class*="frontend-theme-"] .auth-card h1{
  font-size:clamp(1.9rem,3vw,2.35rem);
  line-height:1.12;
  letter-spacing:-.045em;
}

body.guest-shell[class*="frontend-theme-"] :where(.search-box,.search-box-inline){
  border-color:var(--pro-line);
  background:var(--surface);
}

body.guest-shell[class*="frontend-theme-"] :where(.provider-card,.directory-card,.temporary-provider-card,.marketplace-provider-card-v2){
  overflow:hidden;
}

body.guest-shell[class*="frontend-theme-"] :where(.public-page-managed-html__surface,.provider-directory-managed-html__surface){
  line-height:1.72;
}

/* --------------------------------------------------------------------------
   6. Non-admin portal shell
   -------------------------------------------------------------------------- */
body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .sidebar{
  border:1px solid color-mix(in srgb,#fff 10%,transparent);
  box-shadow:0 20px 60px rgba(6,20,38,.16);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .sidebar .brand{
  border-bottom:1px solid color-mix(in srgb,#fff 10%,transparent);
  margin-bottom:10px;
  padding-bottom:18px;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .nav-section-title{
  padding-inline:12px;
  margin-top:8px;
  color:color-mix(in srgb,#fff 52%,transparent);
  font-size:.64rem;
  font-weight:800;
  letter-spacing:.13em;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .side-nav{
  gap:4px;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .side-nav a{
  position:relative;
  min-height:44px;
  padding:10px 12px;
  border:1px solid transparent;
  border-radius:var(--theme-control-radius,12px);
  color:color-mix(in srgb,#fff 78%,transparent);
  font-size:.85rem;
  font-weight:650;
  transition:background-color var(--pro-transition),border-color var(--pro-transition),color var(--pro-transition),transform var(--pro-transition);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .side-nav a:hover{
  border-color:color-mix(in srgb,#fff 10%,transparent);
  background:color-mix(in srgb,#fff 7%,transparent);
  color:#fff;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .side-nav a.active{
  border-color:color-mix(in srgb,#fff 14%,transparent);
  background:color-mix(in srgb,#fff 12%,transparent);
  color:#fff;
  box-shadow:inset 3px 0 0 var(--primary),0 8px 20px rgba(0,0,0,.08);
}

html[dir="rtl"] body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .side-nav a.active{
  box-shadow:inset -3px 0 0 var(--primary),0 8px 20px rgba(0,0,0,.08);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .topbar{
  min-height:72px;
  border:1px solid var(--pro-line);
  background:color-mix(in srgb,var(--surface) 90%,transparent);
  box-shadow:var(--pro-shadow-sm);
  backdrop-filter:blur(18px) saturate(130%);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .page-content{
  padding-bottom:clamp(44px,6vw,76px);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(
  .card,
  .metric-card-pro,
  .doctor-dashboard-metric,
  .quick-action-pro,
  .doctor-command-card,
  .subscription-panel,
  .doctor-plan-panel,
  .doctor-command-panel,
  .doctor-practice-panel,
  .doctor-queue-panel,
  .dashboard-lower-grid > *,
  .doctor-dashboard-lower-grid > *
){
  border-color:var(--pro-line);
  box-shadow:var(--pro-shadow-sm);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.metric-card-pro,.doctor-dashboard-metric) strong{
  letter-spacing:-.035em;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.quick-action-pro,.doctor-command-card){
  transition:transform var(--pro-transition),border-color var(--pro-transition),box-shadow var(--pro-transition),background-color var(--pro-transition);
}

@media (hover:hover) and (pointer:fine){
  body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.quick-action-pro,.doctor-command-card):hover{
    transform:translateY(-2px);
    border-color:var(--pro-hover-border);
    box-shadow:var(--pro-shadow-md);
  }
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.data-table,.table){
  border-color:var(--pro-line);
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.data-table th,.table th){
  background:color-mix(in srgb,var(--surface-2) 88%,var(--surface));
  color:color-mix(in srgb,var(--text) 62%,var(--muted));
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.045em;
  text-transform:uppercase;
}

body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.data-table td,.table td){
  border-color:var(--pro-line);
}

/* --------------------------------------------------------------------------
   7. Theme-by-theme refinement
   -------------------------------------------------------------------------- */
body.frontend-theme-oceanic_pulse:not(.role-admin){
  --theme-card-radius:24px;
  --theme-control-radius:14px;
  --theme-on-primary:#050d15;
  --pro-section-space:clamp(68px,8vw,112px);
}
body.frontend-theme-oceanic_pulse:not(.role-admin) :where(.public-header,.topbar){
  background:color-mix(in srgb,var(--surface) 84%,transparent);
  border-color:color-mix(in srgb,var(--primary) 18%,var(--border));
}
body.frontend-theme-oceanic_pulse:not(.role-admin) :where(.feature-card-premium,.home-provider-finder-card,.metric-card-pro,.doctor-dashboard-metric){
  box-shadow:0 14px 38px rgba(2,95,135,.075);
}
@media (min-width:1100px){
  body.portal-experience.frontend-theme-oceanic_pulse .sidebar{border-radius:28px!important}
  body.portal-experience.frontend-theme-oceanic_pulse :where(.dashboard-hero,.doctor-dashboard-hero){border-radius:30px!important}
}

body.frontend-theme-alpine_frost:not(.role-admin){
  --theme-card-radius:16px;
  --theme-control-radius:10px;
  --theme-button-radius:10px;
}
body.frontend-theme-alpine_frost:not(.role-admin) :where(.public-header,.topbar,.card,.feature-card-premium,.home-provider-finder-card){
  box-shadow:0 8px 24px rgba(30,58,95,.055);
}
body.frontend-theme-alpine_frost:not(.role-admin) .public-links a{
  border-radius:8px;
}
body.frontend-theme-alpine_frost:not(.role-admin) :where(.section-heading,.page-heading,.home-section-heading) h2{
  letter-spacing:-.032em;
}

body.frontend-theme-sakura_health:not(.role-admin){
  --theme-on-primary:#050d15;
  --theme-card-radius:24px;
  --theme-control-radius:14px;
}
body.frontend-theme-sakura_health:not(.role-admin) :where(.public-header,.topbar){
  border-color:color-mix(in srgb,var(--primary) 14%,var(--border));
  box-shadow:0 12px 34px rgba(95,39,79,.07);
}
body.frontend-theme-sakura_health:not(.role-admin) :where(.feature-card-premium,.home-provider-finder-card,.card){
  box-shadow:0 12px 34px rgba(95,39,79,.055);
}

body.frontend-theme-royal_indigo:not(.role-admin){
  --theme-card-radius:20px;
  --theme-control-radius:12px;
  --theme-button-radius:12px;
}
body.frontend-theme-royal_indigo:not(.role-admin) :where(.public-header,.topbar){
  border-color:color-mix(in srgb,var(--primary) 20%,var(--border));
}
body.frontend-theme-royal_indigo:not(.role-admin) :where(.feature-card-premium,.home-provider-finder-card,.card,.metric-card-pro,.doctor-dashboard-metric){
  box-shadow:0 14px 40px rgba(49,46,129,.075);
}

body.frontend-theme-citrus_vital:not(.role-admin){
  --theme-on-primary:#050d15;
  --theme-card-radius:20px;
  --theme-control-radius:12px;
}
body.frontend-theme-citrus_vital:not(.role-admin) :where(.feature-card-premium,.home-provider-finder-card,.card,.topbar){
  border-radius:var(--theme-card-radius);
  clip-path:none;
  box-shadow:0 12px 34px rgba(63,98,18,.06);
}
@media (min-width:1100px){
  body.frontend-theme-citrus_vital:not(.role-admin) .sidebar{border-radius:24px!important}
}

body.frontend-theme-botanical_serenity:not(.role-admin){
  --theme-on-primary:#050d15;
  --theme-card-radius:24px;
  --theme-control-radius:14px;
}
body.frontend-theme-botanical_serenity:not(.role-admin) :where(.feature-card-premium,.home-provider-finder-card,.card,.topbar){
  border-radius:var(--theme-card-radius);
  box-shadow:0 14px 38px rgba(41,74,58,.06);
}
@media (min-width:1100px){
  body.frontend-theme-botanical_serenity:not(.role-admin) .sidebar{border-radius:28px!important}
}

body.frontend-theme-aether_glass:not(.role-admin){
  --theme-card-radius:24px;
  --theme-control-radius:14px;
}
body.frontend-theme-aether_glass:not(.role-admin) :where(.public-header,.topbar,.card,.feature-card-premium,.home-provider-finder-card){
  border-color:color-mix(in srgb,var(--primary) 16%,rgba(255,255,255,.42));
  background-color:color-mix(in srgb,var(--surface) 76%,transparent);
  box-shadow:0 18px 50px rgba(60,45,120,.085);
  backdrop-filter:blur(20px) saturate(135%);
}

body.frontend-theme-kinetic_spectrum:not(.role-admin){
  --theme-on-primary:#050d15;
  --theme-card-radius:16px;
  --theme-control-radius:10px;
  --theme-button-radius:10px;
  --theme-card-transform:none;
}
body.frontend-theme-kinetic_spectrum:not(.role-admin) :where(.public-header,.public-nav,.topbar,.sidebar,.card,.feature-card-premium,.home-provider-finder-card,.dashboard-hero,.doctor-dashboard-hero){
  transform:none!important;
  clip-path:none!important;
}
body.frontend-theme-kinetic_spectrum:not(.role-admin) .side-nav a{
  transform:none!important;
  border-radius:12px!important;
}
body.frontend-theme-kinetic_spectrum:not(.role-admin) .sidebar::after{
  width:4px!important;
  inset:18px -1px 18px auto!important;
  border-radius:999px!important;
  clip-path:none!important;
}
html[dir="rtl"] body.frontend-theme-kinetic_spectrum:not(.role-admin) .sidebar::after{
  inset:18px auto 18px -1px!important;
  transform:none!important;
}
@media (min-width:1100px){
  body.portal-experience.frontend-theme-kinetic_spectrum .sidebar{border-radius:0 24px 24px 0!important}
  html[dir="rtl"] body.portal-experience.frontend-theme-kinetic_spectrum .sidebar{border-radius:24px 0 0 24px!important}
  body.portal-experience.frontend-theme-kinetic_spectrum .topbar{border-radius:18px!important}
  body.portal-experience.frontend-theme-kinetic_spectrum :where(.dashboard-hero,.doctor-dashboard-hero){border-radius:22px!important}
}
body.frontend-theme-kinetic_spectrum:not(.role-admin) .public-header{
  border-top:3px solid transparent;
  border-image:linear-gradient(90deg,var(--kinetic-pink,#ef3f78),var(--kinetic-orange,#ff8a3d),var(--kinetic-cyan,#38c6d9)) 1;
}
body.frontend-theme-kinetic_spectrum:not(.role-admin) :where(.feature-card-premium,.home-provider-finder-card,.card){
  border-radius:var(--theme-card-radius);
  box-shadow:0 12px 34px rgba(36,26,75,.065);
}

/* Primary controls use the stronger brand tone when white text is needed. */
body:is(.frontend-theme-oceanic_pulse,.frontend-theme-sakura_health,.frontend-theme-citrus_vital,.frontend-theme-botanical_serenity,.frontend-theme-kinetic_spectrum):not(.role-admin) .btn-primary{
  background:var(--primary-strong);
  color:#fff;
}
body:is(.frontend-theme-oceanic_pulse,.frontend-theme-sakura_health,.frontend-theme-citrus_vital,.frontend-theme-botanical_serenity,.frontend-theme-kinetic_spectrum):not(.role-admin) .btn-primary:hover{
  background:color-mix(in srgb,var(--primary-strong) 88%,#000);
  color:#fff;
}

/* --------------------------------------------------------------------------
   8. Footer quality
   -------------------------------------------------------------------------- */
body.guest-shell[class*="frontend-theme-"] .public-footer{
  position:relative;
  overflow:hidden;
  padding-top:clamp(56px,7vw,82px);
}

body.guest-shell[class*="frontend-theme-"] .public-footer::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:1px;
  background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--primary) 54%,#fff),transparent);
  opacity:.55;
}

body.guest-shell[class*="frontend-theme-"] .public-footer-grid{
  gap:clamp(32px,4vw,58px);
}

body.guest-shell[class*="frontend-theme-"] .public-footer-grid strong{
  font-size:.72rem;
  letter-spacing:.13em;
}

body.guest-shell[class*="frontend-theme-"] .public-footer-grid :where(a,span){
  line-height:1.55;
}

body.guest-shell[class*="frontend-theme-"] .public-footer-grid a{
  transition:color var(--pro-transition),transform var(--pro-transition);
}

body.guest-shell[class*="frontend-theme-"] .public-footer-grid a:hover{
  transform:translateX(2px);
}

html[dir="rtl"] body.guest-shell[class*="frontend-theme-"] .public-footer-grid a:hover{
  transform:translateX(-2px);
}

/* --------------------------------------------------------------------------
   9. Responsive behavior
   -------------------------------------------------------------------------- */
@media (max-width:1099px){
  body[class*="frontend-theme-"]:not(.role-admin){
    --pro-container:1040px;
  }
  body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .topbar{
    border-radius:0 0 18px 18px;
    border-inline:0;
    border-top:0;
  }
  body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .sidebar{
    border-radius:0 24px 24px 0;
  }
  html[dir="rtl"] body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .sidebar{
    border-radius:24px 0 0 24px;
  }
}

@media (max-width:900px){
  body.guest-shell[class*="frontend-theme-"] .public-nav{
    min-height:68px;
    padding-block:8px;
  }
  body.guest-shell[class*="frontend-theme-"] .public-links{
    top:78px;
    left:clamp(14px,3vw,24px);
    right:clamp(14px,3vw,24px);
    padding:10px;
    gap:3px;
    border:1px solid var(--pro-line);
    border-radius:18px;
    background:color-mix(in srgb,var(--surface) 96%,transparent);
    box-shadow:var(--pro-shadow-lg);
    backdrop-filter:blur(20px) saturate(130%);
  }
  body.guest-shell[class*="frontend-theme-"] .public-links a{
    width:100%;
    min-height:44px;
    padding:11px 13px;
  }
  body.guest-shell[class*="frontend-theme-"] .public-actions .btn-primary{
    min-height:42px;
  }
}

@media (max-width:720px){
  body[class*="frontend-theme-"]:not(.role-admin){
    --pro-card-pad:18px;
    --pro-section-space:58px;
  }
  body[class*="frontend-theme-"]:not(.role-admin) .container{
    width:min(100% - 28px,var(--pro-container));
  }
  body.guest-shell[class*="frontend-theme-"] .public-actions{
    gap:6px;
  }
  body.guest-shell[class*="frontend-theme-"] .public-actions .btn-primary{
    padding-inline:12px;
  }
  body.guest-shell[class*="frontend-theme-"] :where(.home-provider-finder-grid,.feature-grid-premium,.home-network-directory-grid,.marketplace-theme-grid){
    gap:14px;
  }
  body.portal-experience[class*="frontend-theme-"]:not(.role-admin) .page-content{
    padding-inline:14px;
  }
  body.portal-experience[class*="frontend-theme-"]:not(.role-admin) :where(.card,.metric-card-pro,.doctor-dashboard-metric,.quick-action-pro,.doctor-command-card){
    box-shadow:var(--pro-shadow-xs);
  }
}

@media (max-width:520px){
  body.guest-shell[class*="frontend-theme-"] .public-nav .brand img{
    width:38px;
    height:38px;
  }
  body.guest-shell[class*="frontend-theme-"] .brand-copy{
    font-size:.88rem;
  }
  body.guest-shell[class*="frontend-theme-"] .public-actions .icon-button,
  body.guest-shell[class*="frontend-theme-"] .public-menu-toggle{
    width:40px;
    height:40px;
  }
  body.guest-shell[class*="frontend-theme-"] .public-actions .btn-primary svg{
    display:none;
  }
  body.guest-shell[class*="frontend-theme-"] .auth-card{
    padding:22px 18px;
  }
}

/* --------------------------------------------------------------------------
   10. Accessibility and motion safety
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  body[class*="frontend-theme-"]:not(.role-admin) *,
  body[class*="frontend-theme-"]:not(.role-admin) *::before,
  body[class*="frontend-theme-"]:not(.role-admin) *::after{
    scroll-behavior:auto!important;
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
  body[class*="frontend-theme-"]:not(.role-admin) :where(.theme-atmosphere,.theme-atmosphere-shape,.theme-atmosphere-line){
    transform:none!important;
  }
}

@media (prefers-contrast:more){
  body[class*="frontend-theme-"]:not(.role-admin){
    --pro-line:color-mix(in srgb,var(--text) 34%,var(--border));
    --pro-hover-border:color-mix(in srgb,var(--primary) 68%,var(--text));
  }
  body[class*="frontend-theme-"]:not(.role-admin) :where(.btn-outline,.icon-button,.public-menu-toggle,.card,.auth-card){
    border-width:2px;
  }
}

/* Default light-mode muted text meets WCAG AA on the theme surface. */
html:not([data-theme="dark"]) body.frontend-theme-alpine_frost:not(.role-admin){--muted:#5f768b}
html:not([data-theme="dark"]) body.frontend-theme-botanical_serenity:not(.role-admin){--muted:#657767}

/* --------------------------------------------------------------------------
   11. Marketplace provider cards aligned to doctor-directory card system
   -------------------------------------------------------------------------- */
body.guest-shell[class*="frontend-theme-"] .marketplace-theme-grid{
  align-items:stretch;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style{
  position:relative;
  display:flex!important;
  flex-direction:column!important;
  padding:20px!important;
  min-height:100%;
  border:1px solid var(--pro-line)!important;
  border-radius:20px!important;
  background:var(--surface)!important;
  box-shadow:var(--pro-shadow-sm)!important;
  clip-path:none!important;
  transform:none!important;
  overflow:hidden;
  grid-column:auto!important;
  grid-row:auto!important;
  margin-top:0!important;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style:hover{
  transform:translateY(-3px)!important;
  border-color:var(--pro-hover-border)!important;
  box-shadow:var(--pro-shadow-md)!important;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:4px;
  background:var(--primary);
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style.marketplace-role-pharmacy::before{
  background:color-mix(in srgb,var(--primary) 78%,#0f9b8e);
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style.marketplace-role-legacy-provider::before{
  background:color-mix(in srgb,var(--primary) 72%,#4169e1);
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-head{
  gap:14px;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-avatar{
  width:64px!important;
  height:64px!important;
  border-radius:18px!important;
  background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 88%,#fff),color-mix(in srgb,var(--primary) 58%,#1d4ed8));
  box-shadow:0 14px 30px rgba(15,23,42,.12);
  font-size:.86rem;
  letter-spacing:.06em;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-avatar.marketplace-provider-avatar-pharmacy{
  background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 76%,#0f9b8e),color-mix(in srgb,var(--primary) 42%,#0b8275));
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-avatar.marketplace-provider-avatar-legacy-provider{
  background:linear-gradient(145deg,color-mix(in srgb,var(--primary) 82%,#4169e1),color-mix(in srgb,var(--primary) 44%,#1e3a8a));
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-avatar-mark{
  display:block;
  font-weight:850;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-topline--doctor-style{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  color:var(--muted);
  font-size:.63rem;
  font-weight:850;
  letter-spacing:.08em;
  text-transform:uppercase;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-topline--doctor-style b{
  display:inline-flex;
  align-items:center;
  gap:5px;
  color:var(--success);
  font-size:.61rem;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-topline--doctor-style svg{
  width:13px;
  height:13px;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .provider-tags{
  margin:16px 0 14px;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-provider-description,
body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-provider-description-ar{
  margin:0;
  line-height:1.7;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-provider-description-ar{
  margin-top:8px;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-provider-footer{
  align-items:center;
  gap:14px;
  margin-top:auto;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-catalogue-count--doctor-style{
  display:grid;
  gap:3px;
  text-align:left;
}

html[dir="rtl"] body.guest-shell[class*="frontend-theme-"] .marketplace-catalogue-count--doctor-style{
  text-align:right;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-catalogue-count--doctor-style small{
  color:var(--muted);
  font-size:.62rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-catalogue-count--doctor-style strong{
  font-size:1.02rem;
  line-height:1.2;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-catalogue-count--doctor-style strong span{
  color:var(--muted);
  font-size:.72rem;
  font-weight:700;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-catalogue-button{
  white-space:nowrap;
}

body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style :is(.marketplace-card-accent,.marketplace-provider-media,.marketplace-provider-content){
  all:unset;
}

@media (max-width:1024px){
  body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-provider-topline--doctor-style{
    flex-direction:column;
    align-items:center;
    justify-content:center;
  }
}

@media (max-width:650px){
  body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style{
    padding:18px!important;
  }
  body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-provider-footer{
    flex-direction:column;
    align-items:stretch;
  }
  body.guest-shell[class*="frontend-theme-"] .marketplace-provider-card--doctor-style .marketplace-catalogue-button{
    width:100%;
    justify-content:center;
  }
}

/* --------------------------------------------------------------------------
   Shared portal card typography + sidebar spacing reliability
   Applies to every non-admin frontend theme and every authenticated portal.
   -------------------------------------------------------------------------- */
body.portal-experience.ui-v2:not(.role-admin) :where(
  .doctor-command-card > div,
  .quick-action-pro > div,
  .provider-resource-copy,
  .clinic-module-card > div,
  .doctor-practice-actions > a > div,
  .doctor-professional-links > a > div
){
  min-width:0;
}

/* Never split normal UI words in the middle. Long labels may wrap only at
   natural word boundaries, which keeps items such as “Appointments” and
   “Communication” intact across theme-specific dashboard grids. */
body.portal-experience.ui-v2:not(.role-admin) :where(
  .doctor-command-card > div > strong,
  .doctor-command-card > div > small,
  .quick-action-pro strong,
  .clinic-module-card h3,
  .clinic-module-card small,
  .provider-resource-copy strong,
  .doctor-practice-actions strong,
  .doctor-professional-links strong
){
  max-width:100%;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:normal!important;
  hyphens:none!important;
  text-wrap:pretty;
}

/* Shared sidebar spacing. Direct-link portals (patient/account) use the nav
   row gap; provider portals additionally need a gap inside each section. */
body.portal-experience.ui-v2:not(.role-admin) .side-nav{
  row-gap:8px!important;
}
body.provider-portal.portal-experience.ui-v2:not(.role-admin) .provider-nav-section{
  display:grid!important;
  grid-template-columns:minmax(0,1fr);
  row-gap:8px!important;
}
body.provider-portal.portal-experience.ui-v2:not(.role-admin) .provider-nav-section[hidden]{
  display:none!important;
}
body.provider-portal.portal-experience.ui-v2:not(.role-admin) .provider-nav-section > a{
  margin:0!important;
}

/* Keep section labels visually associated with their first card without
   allowing neighboring cards to touch one another. */
body.provider-portal.portal-experience.ui-v2:not(.role-admin) .provider-nav-section > .nav-section-title{
  margin-bottom:-2px;
}
