/* Rifq V4.4 — Ourspecialkids experience layer.
   Intentionally plain CSS so this release does not depend on a Tailwind rebuild. */

:root {
  --v44-ink: #28241f;
  --v44-soft: color-mix(in srgb, var(--primary) 7%, var(--card));
  --v44-line: color-mix(in srgb, var(--primary) 13%, var(--border));
  --v44-shadow: 0 18px 50px rgba(44, 38, 31, .07);
}

/* Typography-only practice identity. There is deliberately no logo mark. */
.practice-brand-block { display: grid; gap: .08rem; min-width: 0; }
.practice-wordmark,
.login-wordmark,
.mobile-brand-name,
.public-practice-wordmark {
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  color: var(--foreground);
  font-weight: 700;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.practice-wordmark { font-size: 1.06rem; line-height: 1.35; }
.practice-wordmark-meta { color: var(--muted-foreground); font-size: .7rem; line-height: 1.35; }
.sidebar-brand-wrap { padding: 1.25rem 1rem .8rem; }
.sidebar-account-wrap { padding: .1rem .72rem .7rem; }
.sidebar-account {
  display: flex; align-items: center; gap: .65rem; padding: .72rem .72rem;
  border: 1px solid var(--sidebar-border); border-radius: .9rem;
  background: color-mix(in srgb, var(--sidebar-accent) 45%, transparent);
}
.account-avatar {
  position: relative;
  width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: .72rem;
  background: var(--primary); color: var(--primary-foreground); flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.account-avatar::after {
  content: "";
  position: absolute;
  inset-inline-end: -.08rem;
  inset-block-end: -.08rem;
  width: .58rem;
  height: .58rem;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--sidebar);
}
.account-name { font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-username { margin-top: .1rem; font-size: .68rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.sidebar-nav { display: flex; flex-direction: column; gap: .16rem; padding: 0 .68rem; }
.sidebar-tools {
  display: flex; flex-direction: column; gap: .18rem; padding: .65rem .68rem .85rem;
  margin-top: .5rem; border-top: 1px solid var(--sidebar-border);
}
.logout-action {
  width: 100%; min-height: 2.5rem; display: flex; align-items: center; gap: .75rem;
  padding: .55rem .75rem; border-radius: .65rem; color: var(--muted-foreground);
  font-size: .8rem; font-weight: 600; transition: background-color .15s ease, color .15s ease;
}
.logout-action:hover { background: var(--sidebar-accent); color: var(--foreground); }
.logout-action-compact { width: auto; min-height: 2.25rem; padding-inline: .6rem; }

.nav-live-badge {
  min-width: 1.15rem; height: 1.15rem; padding-inline: .25rem; border-radius: 999px;
  display: inline-grid; place-items: center; background: var(--primary); color: var(--primary-foreground);
  font-size: .62rem; font-weight: 700; line-height: 1;
}
.nav-live-badge.is-zero { display: none; }

/* Desktop workspace header. */
.workspace-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: 1.45rem 1.55rem; border: 1px solid var(--v44-line); border-radius: 1.15rem;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--primary) 11%, transparent), transparent 36%),
    linear-gradient(135deg, color-mix(in srgb, var(--card) 94%, var(--primary) 6%), var(--card));
  box-shadow: var(--v44-shadow);
}
.workspace-copy { min-width: 0; }
.workspace-brand { color: var(--primary); font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.workspace-title { margin-top: .18rem; color: var(--v44-ink); font-size: clamp(1.55rem, 2.5vw, 2.15rem); line-height: 1.25; font-weight: 700; letter-spacing: -.03em; }
.workspace-subtitle { margin-top: .35rem; color: var(--muted-foreground); font-size: .78rem; line-height: 1.7; }
.workspace-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; max-width: 31rem; }
.workspace-actions .ui-btn { min-height: 2.55rem; }

/* Login: calm, clinic-led, without a placeholder brand icon. */
.login-screen {
  min-height: 100dvh; display: grid; place-items: center; padding: max(1.1rem, env(safe-area-inset-top)) 1rem max(1.1rem, env(safe-area-inset-bottom));
}
.login-card {
  width: min(100%, 29rem); padding: clamp(1.35rem, 4vw, 2rem); border-radius: 1.3rem;
  box-shadow: 0 24px 70px rgba(42, 34, 28, .10); background: color-mix(in srgb, var(--card) 97%, var(--primary) 3%);
}
.login-heading { text-align: center; margin-bottom: 1.55rem; }
.login-wordmark { color: var(--primary); font-size: 1.15rem; }
.login-title { margin-top: .35rem; font-size: 1.55rem; line-height: 1.35; font-weight: 700; color: var(--foreground); }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.password-control { position: relative; }
.login-password-input { padding-left: 3rem !important; padding-right: .8rem !important; }
.password-toggle {
  position: absolute; left: .35rem; top: 50%; transform: translateY(-50%);
  width: 2.35rem; height: 2.35rem; display: grid; place-items: center; border-radius: .65rem;
  color: var(--muted-foreground); border: 1px solid transparent; background: transparent;
  cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.password-toggle:hover { color: var(--foreground); background: var(--accent); }
.password-toggle:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.login-access-note {
  display: flex; gap: .55rem; align-items: flex-start; margin-top: 1rem; padding: .9rem 1rem;
  border: 1px solid var(--v44-line); border-radius: .9rem; background: color-mix(in srgb, var(--primary) 3%, var(--card));
}
.login-help-link { color: var(--primary); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.login-family-cta {
  margin-top: .7rem; display: flex; align-items: center; gap: .65rem; padding: .9rem 1rem;
  border: 1px solid var(--border); border-radius: .9rem; background: var(--card); transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.login-family-cta:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); transform: translateY(-1px); box-shadow: 0 10px 28px rgba(40, 34, 29, .06); }

/* Prospective-family intake. */
.public-form-screen {
  width: min(100%, 62rem); margin-inline: auto; min-height: 100dvh; padding: clamp(1rem, 3vw, 2.4rem) 1rem 3rem;
}
.public-inquiry-header { text-align: center; max-width: 45rem; margin: 0 auto 1.3rem; }
.public-practice-wordmark { color: var(--primary); font-size: 1.05rem; }
.public-inquiry-title { margin-top: .25rem; font-size: clamp(1.7rem, 4vw, 2.45rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.35; }
.public-inquiry-subtitle { margin: .55rem auto 0; max-width: 38rem; color: var(--muted-foreground); font-size: .9rem; line-height: 1.9; }
.public-inquiry-card {
  border: 1px solid var(--v44-line); background: color-mix(in srgb, var(--card) 98%, var(--primary) 2%);
  border-radius: 1.25rem; padding: clamp(1rem, 3vw, 1.75rem); box-shadow: var(--v44-shadow);
}
.public-inquiry-wizard { margin-top: 1.2rem; }
.public-inquiry-wizard .wizard-step { display: grid; gap: 1rem; }
.public-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .9rem; }
.inquiry-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .55rem; }
.inquiry-choice-card {
  display: flex; gap: .6rem; align-items: flex-start; padding: .72rem .8rem; border: 1px solid var(--border);
  border-radius: .8rem; background: var(--background); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.inquiry-choice-card:hover { border-color: color-mix(in srgb, var(--primary) 38%, var(--border)); background: color-mix(in srgb, var(--primary) 3%, var(--background)); }
.inquiry-admin-card { display: block; padding: 1rem; }
.inquiry-card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; padding-top: .75rem; margin-top: .75rem; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: .72rem; }
.public-success-state { min-height: 48vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .65rem; }
.public-success-icon { width: 3.4rem; height: 3.4rem; display: grid; place-items: center; border-radius: 1rem; background: color-mix(in srgb, var(--primary) 11%, transparent); color: var(--primary); }

/* Parent communication thread. */
.parent-note-replies { display: flex; flex-direction: column; gap: .55rem; margin-top: .75rem; }
.parent-reply-bubble,
.portal-reply-bubble {
  max-width: 92%; padding: .72rem .85rem; border-radius: .85rem .85rem .3rem .85rem;
  background: color-mix(in srgb, var(--primary) 8%, var(--card)); border: 1px solid var(--v44-line);
  font-size: .78rem; line-height: 1.8;
}
.parent-reply-form { display: grid; gap: .55rem; margin-top: .8rem; }

/* Realtime notification toast. */
.realtime-toast-root { position: fixed; z-index: 90; inset-inline-start: 1rem; top: max(1rem, env(safe-area-inset-top)); display: grid; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.realtime-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: .65rem; padding: .85rem .95rem;
  border: 1px solid var(--v44-line); border-radius: .9rem; background: color-mix(in srgb, var(--card) 96%, var(--primary) 4%);
  box-shadow: 0 18px 45px rgba(38, 31, 27, .14); animation: v44ToastIn .22s ease-out;
}
.realtime-toast-title { font-size: .78rem; font-weight: 700; }
.realtime-toast-copy { margin-top: .1rem; color: var(--muted-foreground); font-size: .7rem; line-height: 1.6; }
@keyframes v44ToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* PWA install experience. */
.pwa-install-panel { display: grid; gap: .75rem; }
.pwa-install-status { color: var(--muted-foreground); font-size: .75rem; line-height: 1.7; }
.pwa-ios-hint { display: none; padding: .75rem .85rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--muted); color: var(--muted-foreground); font-size: .75rem; line-height: 1.8; }
.pwa-ios-hint.is-visible { display: block; }

/* Structured session location. */
.session-location-extra { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .75rem; padding: .9rem; border: 1px dashed var(--v44-line); border-radius: .85rem; background: color-mix(in srgb, var(--primary) 2.5%, var(--card)); }

@media (min-width: 1024px) {
  .app-viewport > aside { width: 15.75rem; }
  .sidebar-nav { flex: 0 0 auto; }
  .sidebar-tools { margin-top: .45rem; }
}

@media (max-width: 767px) {
  .workspace-hero { align-items: stretch; flex-direction: column; padding: 1.1rem; border-radius: 1rem; }
  .workspace-actions { max-width: none; }
  .workspace-actions .ui-btn { flex: 1 1 calc(50% - .3rem); justify-content: center; }
  .public-form-grid, .inquiry-choice-grid, .session-location-extra { grid-template-columns: 1fr; }
  .login-card { padding: 1.2rem; border-radius: 1rem; }
  .public-inquiry-card { padding: 1rem; }
}

@media (display-mode: standalone) {
  .app-topbar { padding-top: max(.55rem, env(safe-area-inset-top)); }
}

/* Actual public intake markup aliases. */
.public-wordmark { color: var(--primary); font-size: 1.05rem; font-weight: 700; }
.public-form-head { text-align: center; max-width: 44rem; margin: 0 auto 1.15rem; }
.public-form-kicker { margin-top: .2rem; color: var(--muted-foreground); font-size: .72rem; font-weight: 600; }
.public-form-title { margin-top: .3rem; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.4; font-weight: 700; letter-spacing: -.035em; }
.public-form-subtitle { margin: .55rem auto 0; max-width: 38rem; color: var(--muted-foreground); font-size: .86rem; line-height: 1.9; }
.public-form-card { border: 1px solid var(--v44-line); background: color-mix(in srgb, var(--card) 98%, var(--primary) 2%); border-radius: 1.25rem; padding: clamp(1rem, 3vw, 1.75rem); box-shadow: var(--v44-shadow); }
.public-form-privacy { margin-top: .8rem; text-align: center; color: var(--muted-foreground); font-size: .7rem; }
.inquiry-textarea { min-height: 7rem; resize: vertical; }
.session-location-booking, .session-document-context { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .85rem; align-items: start; }
.session-location-booking .session-location-extra, .session-document-context .session-location-extra { grid-column: 1 / -1; }
.realtime-toast-icon { color: var(--primary); margin-top: .22rem; font-size: .7rem; }
.realtime-toast-copy { display: grid; gap: .12rem; }
.realtime-toast-copy strong { font-size: .78rem; }
.realtime-toast-copy small { color: var(--muted-foreground); font-size: .68rem; }
@media (max-width: 767px) { .session-location-booking, .session-document-context { grid-template-columns: 1fr; } }
.family-reply-bubble { max-width: 92%; padding: .72rem .85rem; border-radius: .85rem .85rem .3rem .85rem; background: color-mix(in srgb, var(--primary) 8%, var(--card)); border: 1px solid var(--v44-line); font-size: .78rem; line-height: 1.8; }
.family-reply-form { display: grid; gap: .55rem; margin-top: .8rem; }
.public-form-alerts { display: grid; gap: .55rem; margin-bottom: .9rem; }

/* ── V4.4.1 UX hardening ---------------------------------------------------
   A restrained mobile-app layer: calmer chrome, compact information density,
   resilient controls and progressive disclosure. app.css stays untouched. */

/* V4.4.2 replaces cross-document transitions with a shell-preserving,
   same-document navigation controller. Full-page navigation remains the fallback. */
:root {
  --v441-radius-lg: 1.15rem;
  --v441-radius-md: .9rem;
  --v441-shadow-soft: 0 10px 34px rgba(42, 36, 31, .055), 0 1px 2px rgba(42, 36, 31, .035);
  --v441-shadow-float: 0 18px 44px rgba(42, 36, 31, .11);
}
.app-topbar { view-transition-name: app-topbar; }
.mobile-bottom-nav { view-transition-name: app-bottom-nav; }
.app-main-content { view-transition-name: app-main-content; }
.page-content { animation: none !important; }
::view-transition-old(app-main-content) { animation: v441PageOut .11s ease-in both; }
::view-transition-new(app-main-content) { animation: v441PageIn .18s cubic-bezier(.2,.8,.2,1) both; }
::view-transition-old(app-topbar),
::view-transition-new(app-topbar),
::view-transition-old(app-bottom-nav),
::view-transition-new(app-bottom-nav) { animation: none; }
@keyframes v441PageOut { to { opacity: .84; transform: translateY(2px); } }
@keyframes v441PageIn { from { opacity: .82; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Mobile application chrome. Keep browser/PWA chrome neutral; the practice
   accent belongs to controls and state rather than a large status-bar slab. */
.app-topbar {
  justify-content: space-between;
  border-bottom-color: color-mix(in srgb, var(--foreground) 7%, transparent);
  background: color-mix(in srgb, var(--background) 97%, white 3%);
  box-shadow: 0 1px 0 rgba(42,36,31,.025);
}
/* Mobile header identity is intentionally stacked. app.css carries an older
   horizontal flex rule, so this later layer must explicitly reset direction and
   gap instead of relying on source-order side effects. */
.mobile-app-identity {
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: .03rem;
}
.mobile-brand-name {
  color: var(--muted-foreground);
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .01em;
}
.mobile-screen-title {
  margin-top: .08rem;
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -.015em;
}
.mobile-notification-action { position: relative; flex: none; }
.app-header-badge {
  position: absolute;
  inset-inline-start: -.28rem;
  top: -.25rem;
  min-width: 1.12rem;
  height: 1.12rem;
  padding-inline: .25rem;
  border: 2px solid var(--background);
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: .58rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(42,36,31,.12);
}
.app-header-badge.is-zero { display: none; }

/* Today workspace: one confident hierarchy, less nested-dashboard feeling. */
.workspace-hero {
  gap: 1rem;
  padding: 1.2rem 1.25rem;
  border-radius: var(--v441-radius-lg);
  border-color: color-mix(in srgb, var(--primary) 15%, var(--border));
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 6%, var(--card)) 0%,
    color-mix(in srgb, var(--card) 99%, var(--primary) 1%) 58%,
    var(--card) 100%);
  box-shadow: 0 12px 36px rgba(42, 36, 31, .055);
}
.workspace-hero::before {
  content: "";
  position: absolute;
  inset-inline-end: -3.25rem;
  inset-block-start: -4rem;
  width: 10rem;
  height: 10rem;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%);
}
.workspace-copy,
.workspace-actions { position: relative; z-index: 1; }
.workspace-brand { font-size: .68rem; color: var(--primary); }
.workspace-title {
  margin-top: .12rem;
  font-size: clamp(1.45rem, 4.8vw, 2.05rem);
  line-height: 1.22;
  letter-spacing: -.035em;
}
.workspace-subtitle { margin-top: .28rem; font-size: .77rem; line-height: 1.65; }
.workspace-actions { width: min(100%, 31rem); max-width: 31rem; }
.workspace-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  width: 100%;
}
.workspace-action {
  width: 100%;
  min-width: 0;
  min-height: 2.85rem !important;
  padding: .58rem .7rem !important;
  gap: .42rem;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.35 !important;
}
.workspace-action > [data-icon-sh],
.workspace-action > iconify-icon { flex: 0 0 auto; }
.workspace-action > span:not([data-icon-sh]) { min-width: 0; }

/* Compact stat cards. The value is prominent but the card no longer wastes
   a large vertical block on a single digit. */
.stat-card {
  min-width: 0;
  border-color: color-mix(in srgb, var(--foreground) 8%, var(--border));
  box-shadow: 0 1px 2px rgba(42,36,31,.035);
}
.stat-card-inner {
  min-height: 7.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .68rem;
  padding: .9rem;
}
.stat-card-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
  min-width: 0;
}
.stat-card-copy { min-width: 0; display: grid; gap: .25rem; }
.stat-card-label {
  color: var(--muted-foreground);
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.45;
}
.stat-card-value {
  color: var(--foreground);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 780;
  letter-spacing: -.025em;
}
.stat-card-subtitle {
  color: var(--muted-foreground);
  font-size: .69rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.stat-card .p-2\.5.rounded-xl,
.stat-card-headline > div:last-child {
  padding: .58rem;
  border-radius: .8rem;
  flex: none;
}

/* All application buttons must remain valid under Arabic text expansion. */
.workspace-hero .ui-btn,
.settings-disclosure .ui-btn,
.public-form-card .ui-btn {
  max-width: 100%;
}

/* Settings progressive disclosure. Secondary configuration stays folded until
   the user needs it, with native keyboard/accessibility semantics. */
.settings-disclosure-stack { display: grid; gap: .7rem; }
.settings-disclosure {
  overflow: clip;
  border: 1px solid color-mix(in srgb, var(--foreground) 8%, var(--border));
  border-radius: var(--v441-radius-md);
  background: color-mix(in srgb, var(--card) 99%, var(--primary) 1%);
  box-shadow: 0 1px 2px rgba(42,36,31,.025);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.settings-disclosure[open] {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
  box-shadow: var(--v441-shadow-soft);
}
.settings-disclosure-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.settings-disclosure-summary::-webkit-details-marker { display: none; }
.settings-disclosure-summary::marker { content: ""; }
.settings-disclosure-summary-inner {
  min-height: 4.55rem;
  display: flex;
  align-items: center;
  gap: .78rem;
  padding: .85rem .95rem;
}
.settings-disclosure-icon {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: .78rem;
  background: color-mix(in srgb, var(--primary) 8%, var(--background));
  border: 1px solid color-mix(in srgb, var(--primary) 10%, transparent);
}
.settings-disclosure-title { font-size: .86rem; font-weight: 750; line-height: 1.45; }
.settings-disclosure-subtitle {
  margin-top: .13rem;
  color: var(--muted-foreground);
  font-size: .69rem;
  line-height: 1.55;
}
.settings-disclosure-chevron {
  flex: none;
  color: var(--muted-foreground);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), color .16s ease;
}
.settings-disclosure[open] .settings-disclosure-chevron { transform: rotate(180deg); color: var(--primary); }
.settings-disclosure-body {
  padding: .95rem;
  border-top: 1px solid color-mix(in srgb, var(--foreground) 7%, var(--border));
  background: color-mix(in srgb, var(--background) 30%, transparent);
}
.settings-inline-status {
  color: var(--muted-foreground);
  font-size: .7rem;
  line-height: 1.55;
  transition: color .15s ease;
}
.settings-inline-status[data-state="saving"] { color: var(--primary); }
.settings-inline-status[data-state="saved"] { color: var(--success); }
.settings-inline-status[data-state="error"] { color: var(--destructive); }

/* Notification surfaces: visible but not intrusive. */
.realtime-toast-root {
  inset-inline-start: 1rem;
  top: calc(max(.75rem, env(safe-area-inset-top)) + var(--app-header-height));
}
.realtime-toast {
  opacity: 0;
  transform: translateY(-7px) scale(.985);
  border-radius: 1rem;
  box-shadow: var(--v441-shadow-float);
  transition: opacity .18s ease, transform .18s cubic-bezier(.2,.8,.2,1);
  animation: none;
}
.realtime-toast.is-visible { opacity: 1; transform: none; }
.realtime-toast-icon {
  width: .55rem;
  height: .55rem;
  border-radius: 999px;
  margin-top: .35rem;
  background: var(--primary);
  color: transparent;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent);
  flex: none;
}
.realtime-toast-copy { min-width: 0; }

/* Public family intake reads like a calm guided service form rather than an
   administrative form. */
.public-form-card { box-shadow: var(--v441-shadow-soft); }
.public-form-card .field-input,
.public-form-card [data-slot="select-trigger"] { min-height: 2.9rem; }
.inquiry-choice-card { min-height: 3.1rem; align-items: center; }
.inquiry-choice-card:has(input:checked) {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
  background: color-mix(in srgb, var(--primary) 7%, var(--background));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 8%, transparent);
}

@media (max-width: 767px) {
  .app-topbar {
    min-height: calc(3.35rem + env(safe-area-inset-top, 0px));
    padding: calc(.48rem + env(safe-area-inset-top, 0px)) .85rem .48rem;
  }
  .app-header-action { width: 2.3rem; height: 2.3rem; border-radius: .65rem; }
  .workspace-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 1rem;
    gap: .9rem;
    border-radius: 1rem;
  }
  .workspace-brand { display: none; }
  .workspace-title { margin-top: 0; font-size: clamp(1.55rem, 7vw, 1.95rem); }
  .workspace-subtitle { font-size: .75rem; }
  .workspace-actions { width: 100%; max-width: none; }
  .workspace-action-grid { gap: .5rem; }
  .workspace-action { min-height: 3rem !important; font-size: .78rem !important; }
  .stat-card-inner { min-height: 6.75rem; padding: .82rem; gap: .55rem; }
  .stat-card-value { font-size: 1.45rem; }
  .stat-card-label { font-size: .73rem; }
  .stat-card-subtitle { font-size: .66rem; }
  .settings-disclosure-summary-inner { min-height: 4.25rem; padding: .78rem .82rem; }
  .settings-disclosure-body { padding: .82rem; }
  .settings-disclosure-subtitle { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .realtime-toast-root {
    inset-inline: .75rem;
    top: calc(max(.55rem, env(safe-area-inset-top)) + 3.45rem);
    width: auto;
  }
  .realtime-toast { padding: .78rem .82rem; }
}

@media (max-width: 370px) {
  .workspace-action-grid { grid-template-columns: 1fr; }
  .workspace-action { min-height: 2.85rem !important; }
}

/* app.css is deliberately checksum-frozen. Repeat the desktop chrome guard in
   this later stylesheet so no legacy .app-topbar display rule or browser cache
   can resurrect the mobile header beside the desktop sidebar. */
@media (min-width: 1024px) {
  .app-topbar { display: none !important; }
  .mobile-bottom-nav { display: none !important; }
  .app-viewport { height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(app-main-content),
  ::view-transition-new(app-main-content) { animation: none !important; }
  .settings-disclosure-chevron,
  .realtime-toast { transition: none !important; }
}

/* ── V4.4.2 navigation + header premium refactor ---------------------------
   New pattern (explicit): shell-preserving primary navigation. It keeps the
   existing server-rendered stack, but swaps only .app-main-content after a
   guarded same-origin fetch. No SPA framework and no new design tokens. */

/* Same-document transition: content only. Persistent chrome never flashes. */
.app-main-content { view-transition-name: rifq-main; outline: none; }
::view-transition-old(rifq-main) {
  animation: v442ContentOut .075s cubic-bezier(.4,0,1,1) both;
}
::view-transition-new(rifq-main) {
  animation: v442ContentIn .14s cubic-bezier(.16,1,.3,1) both;
}
@keyframes v442ContentOut {
  to { opacity: .72; transform: translateY(1px); }
}
@keyframes v442ContentIn {
  from { opacity: .70; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Desktop deliberately has no duplicate utility header.
   Practice identity, current section, and notifications already have stable homes
   in the sidebar. The main pane starts directly with page content. */

/* Sidebar: refined density and a single calm active-state language. */
.sidebar-brand-wrap {
  padding: 1.08rem .92rem .72rem;
  border-bottom: 1px solid color-mix(in srgb, var(--foreground) 6%, var(--sidebar-border));
}
.practice-wordmark { font-size: 1rem; letter-spacing: -.02em; }
.sidebar-account-wrap { padding: .72rem .68rem .58rem; }
.sidebar-account {
  padding: .62rem .66rem;
  border-radius: .78rem;
  background: color-mix(in srgb, var(--sidebar-accent) 30%, transparent);
  border-color: color-mix(in srgb, var(--foreground) 6%, var(--sidebar-border));
}
.sidebar-nav { gap: .12rem; padding-inline: .58rem; }
.nav-link {
  min-height: 2.42rem;
  padding: .48rem .72rem !important;
  border-radius: .68rem !important;
  transition-property: background-color, color, box-shadow, border-color !important;
  transition-duration: .14s !important;
  transition-timing-function: ease !important;
}
.nav-link::before {
  width: 2px;
  height: 48%;
  border-radius: 999px;
  background: var(--primary) !important;
  transition: transform .14s cubic-bezier(.2,.8,.2,1) !important;
}
.nav-link[aria-current="page"] {
  color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 7%, var(--sidebar)) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 7%, transparent);
  font-weight: 680;
}
.nav-link[aria-current="page"]::before { transform: translateY(-50%) scaleY(1); }
.nav-link:not([aria-current="page"]):hover {
  background: color-mix(in srgb, var(--foreground) 3.5%, var(--sidebar));
  color: var(--foreground);
}
.sidebar-tools {
  margin-top: .42rem;
  padding: .58rem .58rem .72rem;
  border-top-color: color-mix(in srgb, var(--foreground) 6%, var(--sidebar-border));
}

/* Mobile top chrome: one compact hierarchy and one deliberate action. */
.app-topbar {
  min-height: calc(3.45rem + env(safe-area-inset-top, 0px));
  padding: calc(.44rem + env(safe-area-inset-top, 0px)) .82rem .44rem;
  gap: .7rem;
  border-bottom-color: color-mix(in srgb, var(--foreground) 5%, transparent);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--background) 97%, transparent) 0%,
    color-mix(in srgb, var(--background) 90%, transparent) 100%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  backdrop-filter: blur(20px) saturate(125%);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--border) 38%, transparent);
}
.app-topbar.is-scrolled {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--background) 99%, transparent) 0%,
    color-mix(in srgb, var(--background) 94%, transparent) 100%);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--border) 58%, transparent),
    0 12px 32px rgba(42, 36, 31, .055);
}
.mobile-app-identity { gap: 0; }
.mobile-brand-name {
  color: var(--muted-foreground);
  font-size: .61rem;
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: .008em;
}
.mobile-screen-title {
  margin-top: .06rem;
  color: var(--foreground);
  font-size: 1.02rem;
  font-weight: 780;
  line-height: 1.28;
  letter-spacing: -.018em;
}
.app-header-action {
  width: 2.28rem;
  height: 2.28rem;
  border-radius: .65rem;
  border-color: color-mix(in srgb, var(--foreground) 8%, var(--border));
  background: color-mix(in srgb, var(--card) 98%, var(--primary) 2%);
  color: var(--muted-foreground);
  box-shadow: 0 1px 2px rgba(42,36,31,.035);
  transition: transform .12s ease, color .14s ease, border-color .14s ease, background-color .14s ease;
}
.app-header-action:active { transform: scale(.95); }
.app-header-action:hover,
.app-header-action[aria-current="page"] {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
}

@keyframes app-badge-pop {
  from { transform: scale(.55); opacity: .35; }
  70% { transform: scale(1.12); opacity: 1; }
  to { transform: scale(1); opacity: 1; }
}
.app-header-badge.is-updated { animation: app-badge-pop .24s cubic-bezier(.2,.8,.2,1); }

/* One semantic title scale for route headers. The mobile app-topbar is hidden at
   desktop width, so desktop hierarchy belongs to page_header rather than a dead
   .mobile-screen-title override. */
.page-title { font-size: 1.25rem; line-height: 1.3; letter-spacing: -.025em; }
@media (min-width: 1024px) {
  .page-title { font-size: 1.55rem; line-height: 1.25; letter-spacing: -.03em; }
}

/* Mobile primary navigation: stable dock with a soft active capsule, no jump. */
.mobile-bottom-nav {
  min-height: calc(4.1rem + env(safe-area-inset-bottom, 0px));
  padding: .34rem .45rem calc(.34rem + env(safe-area-inset-bottom, 0px));
  border-top-color: color-mix(in srgb, var(--foreground) 6%, var(--border));
  background: color-mix(in srgb, var(--background) 92%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  backdrop-filter: blur(20px) saturate(125%);
  box-shadow: 0 -8px 28px rgba(42,36,31,.055);
}
.mobile-nav-item {
  min-height: 3.25rem;
  gap: .16rem;
  margin-inline: .1rem;
  border-radius: .82rem;
  color: var(--muted-foreground);
  transition: color .14s ease, background-color .14s ease;
}
.mobile-nav-item::before { display: none !important; }
.mobile-nav-item[aria-current="page"] {
  color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.mobile-nav-item:not([aria-current="page"]):hover {
  color: var(--foreground);
  background: color-mix(in srgb, var(--foreground) 3%, transparent);
}

/* The utility header owns the practice context now; avoid duplicate brand copy
   inside the dashboard hero. */
.workspace-brand { display: none; }

@media (min-width: 1024px) {
  /* app.css defines .app-topbar{display:flex} after the generated lg:hidden
     utility, so source-order can resurrect mobile chrome on desktop. The
     experience layer owns the final responsive contract explicitly. */
  .app-topbar { display: none !important; }
  .app-viewport > aside { width: 15.5rem; }
  .app-scroll { position: relative; }
  .app-main-content { padding-top: 1.35rem; }
}

@media (max-width: 767px) {
  .workspace-hero { margin-top: .08rem; }
  .app-main-content { padding-top: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(rifq-main),
  ::view-transition-new(rifq-main) { animation: none !important; }
  .nav-link,
  .mobile-nav-item,
  .app-header-action { transition: none !important; }
  .app-header-action:active { transform: none !important; }
  .app-header-badge.is-updated { animation: none !important; }
}

/* ── V4.4.3 Round 2: cleanup, RTL and spacing audit ----------------------
   Uses the existing spacing/color system. No new color or typography tokens. */

/* Dashboard overview: the apparent "empty bar" was a zero-gap seam where the
   bordered hero and KPI grid touched. Keep them as separate surfaces with the
   existing 1rem rhythm; no empty wrapper or decorative strip remains. */
.dashboard-overview {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.dashboard-overview > * { margin-block: 0 !important; }
.dashboard-stat-grid { margin-block: 0 !important; }

/* One spacing contract for grouped actions/toolbars. page_header may receive an
   already-grouped Div, so normalize that nested group as well. */
.app-action-group { gap: .75rem !important; }
.page-header-actions > div:has(> .ui-btn, > form > .ui-btn),
.page-header-actions > form:has(> .ui-btn) {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.section-card-action:has(> .ui-btn, > form > .ui-btn) {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

/* Bidi-safe form controls. dir=auto on the reusable Input/Textarea components
   lets an empty Arabic control inherit RTL, then switches naturally for a Latin
   email/username value. The UI alignment stays logical instead of hard-left. */
.app-theme [data-slot="input"],
.app-theme [data-slot="textarea"],
.app-theme [data-slot="select-trigger"] {
  text-align: start;
  unicode-bidi: plaintext;
}
.app-theme [data-slot="input"]::placeholder,
.app-theme [data-slot="textarea"]::placeholder {
  text-align: start;
}
.app-theme [data-slot="select-trigger"],
.app-theme .select-popover,
.app-theme .ui-date-field,
.app-theme .ui-time-field,
.app-theme .ui-datetime-field,
.app-theme .ui-select-field {
  direction: rtl;
}
.app-theme table { direction: rtl; }
.app-theme th,
.app-theme td { text-align: start; }

/* Popover containment. Anchor to the logical end of the field instead of
   centering with a transform, which could push a 20rem panel beyond a narrow
   card/viewport. Cards containing these controls remain overflow-visible. */
.date-field-popover,
.time-field-popover {
  inset-inline-end: 0;
  inset-inline-start: auto;
  transform: none !important;
  max-width: calc(100vw - 2rem);
}
.date-field-popover { width: min(20rem, calc(100vw - 2rem)); }
.time-field-popover { width: min(18rem, calc(100vw - 2rem)); }
.section-card:has(.ui-date-field, .ui-time-field, .ui-datetime-field, .ui-select-field) {
  overflow: visible !important;
}

/* The hero should read as the first workspace surface, not as a stacked card
   welded to the KPI row. Keep its visual treatment calm and consistent. */
.workspace-hero {
  box-shadow: 0 10px 34px rgba(42, 36, 31, .05);
}

@media (max-width: 767px) {
  .dashboard-overview { gap: .85rem; margin-bottom: 1.1rem; }
  .app-action-group { gap: .625rem !important; }
  .page-header-actions > div:has(> .ui-btn, > form > .ui-btn),
  .page-header-actions > form:has(> .ui-btn) { gap: .625rem; }
  .date-field-popover,
  .time-field-popover {
    width: min(20rem, calc(100vw - 1.25rem));
    max-width: calc(100vw - 1.25rem);
  }
}

/* ── V4.4.3 Round 2 R4: mobile calendar viewport containment ------------
   Explicit pattern: on phone-sized viewports, date/time popovers become a
   fixed overlay sheet above the persistent bottom navigation. This reuses the
   existing bottom-nav/header sizing tokens and prevents the calendar from
   being clipped underneath the dock when its trigger is near the viewport
   bottom. Desktop/tablet anchoring remains unchanged. */
@media (max-width: 767px) {
  .date-field-popover,
  .time-field-popover {
    position: fixed !important;
    inset-inline: .625rem !important;
    inset-block-start: auto !important;
    inset-block-end: calc(var(--app-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + .5rem) !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - var(--app-header-height) - var(--app-bottom-nav-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.25rem);
    margin: 0 !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 70;
  }
}


/* ── V4.4.4 Premium top chrome ------------------------------------------------
   Refines existing shell primitives only: no new color/spacing token family.
   Desktop keeps the intentionally removed duplicate app-topbar; mobile receives
   the premium chrome treatment above, while page_header owns desktop type scale. */
