:root {
  color-scheme: light;
  --canvas: #ddf7f8;
  --canvas-strong: #c9eef3;
  --surface: #ffffff;
  --surface-subtle: #e1f7f9;
  --surface-muted: #cfeef3;
  --ink: #12385f;
  --ink-strong: #092f63;
  --ink-soft: #315a7c;
  --muted: #4e6f8c;
  --muted-light: #52728d;
  --line: rgba(9, 95, 137, 0.16);
  --line-strong: rgba(9, 83, 126, 0.27);
  --nav: #123f82;
  --nav-elevated: rgba(4, 42, 87, 0.36);
  --nav-text: #f7fdff;
  --nav-muted: #d7f3f7;
  --primary: #087d9f;
  --primary-hover: #066a8d;
  --primary-active: #07537d;
  --primary-soft: rgba(12, 181, 203, 0.14);
  --primary-line: rgba(8, 125, 159, 0.3);
  --success: #067647;
  --success-hover: #05603a;
  --success-soft: #ecfdf3;
  --warning: #92400e;
  --warning-hover: #78350f;
  --warning-soft: #fffbeb;
  --danger: #b42318;
  --danger-hover: #912018;
  --danger-soft: #fef3f2;
  --focus: #07537d;
  --accent-cyan: #0cb5cb;
  --accent-cyan-soft: #79e4f0;
  --nav-gradient:
    radial-gradient(circle at 8% 92%, rgba(12, 181, 203, 0.3), transparent 35%),
    linear-gradient(160deg, #123f82 0%, #075f92 54%, #06758f 100%);
  --shadow-xs: 0 1px 2px rgba(5, 60, 96, 0.05);
  --shadow-sm: 0 8px 22px rgba(5, 60, 96, 0.07);
  --shadow-md: 0 16px 36px rgba(5, 60, 96, 0.1);
  --shadow-lg: 0 24px 56px rgba(5, 48, 88, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --ease: 180ms cubic-bezier(0.2, 0, 0, 1);
  --icon-dashboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E");
  --icon-users: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  --icon-user-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='8.5' cy='7' r='4'/%3E%3Cpath d='M19 8v6M22 11h-6'/%3E%3C/svg%3E");
  --icon-history: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5M12 7v5l3 2'/%3E%3C/svg%3E");
  --icon-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
  --icon-note: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z'/%3E%3Cpath d='M14 2v6h6M8 13h8M8 17h6'/%3E%3C/svg%3E");
  --icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E");
  --icon-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0M12 17v5M8 22h8'/%3E%3C/svg%3E");
  --icon-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
  --icon-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4,
strong {
  color: var(--ink-strong);
}

h1,
h2,
h3,
h4 {
  font-family: "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

small {
  line-height: 1.45;
}

svg {
  display: block;
}

::selection {
  background: rgba(121, 228, 240, 0.68);
  color: var(--ink-strong);
}

.hidden,
.hidden-list,
.collapsed-content.hidden-list,
.ta-section-body.collapsed,
.staff-assignment-body.collapsed {
  display: none !important;
}

.muted {
  color: var(--muted) !important;
}

.skip-link {
  position: fixed;
  z-index: 10000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink-strong);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Authentication */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 52px);
  background: var(--canvas);
}

.auth-layout {
  width: min(520px, 100%);
  min-height: 0;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-story {
  isolation: isolate;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(38px, 5vw, 68px);
  background:
    radial-gradient(circle at 95% 5%, rgba(12, 181, 203, 0.28), transparent 25rem),
    radial-gradient(circle at 8% 92%, rgba(8, 125, 159, 0.2), transparent 23rem),
    var(--nav);
  color: #fff;
}

.auth-story::before,
.auth-story::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.auth-story::before {
  inset: 0;
  opacity: 0.15;
  background-image: radial-gradient(rgba(255, 255, 255, 0.6) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom right, #000, transparent 72%);
}

.auth-story::after {
  right: -150px;
  bottom: -150px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 62px rgba(255, 255, 255, 0.025), 0 0 0 124px rgba(255, 255, 255, 0.018);
}

.auth-brand,
.brand-mark,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand {
  position: relative;
  z-index: 1;
}

.auth-brand strong {
  display: block;
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: -0.025em;
}

.auth-brand small {
  display: block;
  margin-top: 1px;
  color: #aeb7c6;
  font-size: 0.76rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(5, 60, 96, 0.22);
}

.brand-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-icon.small {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-radius: 11px;
}

.brand-icon.small svg {
  width: 22px;
  height: 22px;
}

.auth-story-copy {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: auto 0 36px;
}

.product-kicker,
.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.auth-story .product-kicker {
  color: var(--accent-cyan-soft);
}

.auth-story-copy h1,
.auth-story-copy h2 {
  max-width: 560px;
  margin-bottom: 20px;
  color: #fff;
  font-size: clamp(2.55rem, 4.5vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.055em;
}

.auth-story-copy > p:last-child {
  max-width: 560px;
  margin-bottom: 0;
  color: #c9d0db;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.7;
}

.auth-feature-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-feature {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.055);
}

.auth-feature strong,
.auth-feature small {
  display: block;
}

.auth-feature strong {
  margin-bottom: 2px;
  color: #fff;
  font-size: 0.88rem;
}

.auth-feature small {
  color: #aeb7c6;
  font-size: 0.79rem;
}

.feature-icon,
.metric-icon {
  display: grid;
  place-items: center;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.feature-icon {
  width: 22px;
  height: 22px;
  margin: auto;
  color: var(--accent-cyan-soft);
}

.feature-icon-roles {
  -webkit-mask-image: var(--icon-users);
  mask-image: var(--icon-users);
}

.feature-icon-notes {
  -webkit-mask-image: var(--icon-note);
  mask-image: var(--icon-note);
}

.feature-icon-history {
  -webkit-mask-image: var(--icon-history);
  mask-image: var(--icon-history);
}

.auth-story-foot {
  position: relative;
  z-index: 1;
  margin: 24px 0 0;
  color: #7f8a9c;
  font-size: 0.75rem;
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 5vw, 48px);
  background: var(--surface);
}

.login-brand {
  margin-bottom: 28px;
}

.login-brand strong,
.login-brand small {
  display: block;
}

.login-brand strong {
  color: var(--ink-strong);
  font-size: 1.02rem;
  letter-spacing: -0.025em;
}

.login-brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.75rem;
}

.login-card-header {
  margin-bottom: 30px;
}

.login-card-header h1,
.login-card-header h2 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.login-card-header > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-field {
  gap: 7px;
}

.role-preview {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.86rem;
}

.role-preview:empty {
  visibility: hidden;
}

.role-preview.found {
  border-color: #a7f3d0;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 700;
}

.login-form .primary-btn {
  margin-top: 4px;
}

.login-help {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  margin-top: 26px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.login-help > span {
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 10px;
  background-color: var(--muted);
  -webkit-mask-image: var(--icon-lock);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 18px;
  mask-image: var(--icon-lock);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 18px;
}

.login-help p,
.login-help strong,
.login-help small {
  display: block;
  margin: 0;
}

.login-help strong {
  font-size: 0.78rem;
}

.login-help small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.login-help code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}

/* Application shell */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
  background: var(--canvas);
}

.sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 24px 18px 18px;
  background: var(--nav);
  color: var(--nav-text);
}

.sidebar-brand {
  min-height: 48px;
  padding: 0 8px;
  margin-bottom: 16px;
}

.sidebar-brand .brand-icon {
  background: var(--primary);
  box-shadow: none;
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand strong {
  color: #fff;
  font-size: 1.03rem;
  letter-spacing: -0.025em;
}

.sidebar-brand small {
  margin-top: 1px;
  color: var(--nav-muted);
  font-size: 0.75rem;
}

.nav-section-label {
  margin: 0;
  padding: 0 12px 7px;
  color: #717b8d;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-nav {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  position: relative;
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--nav-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  transition: color var(--ease), background-color var(--ease), border-color var(--ease);
}

.nav-btn::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-note);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 20px;
  mask-image: var(--icon-note);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 20px;
}

.nav-btn[data-page="overview"]::before {
  -webkit-mask-image: var(--icon-dashboard);
  mask-image: var(--icon-dashboard);
}

.nav-btn[data-page="patients"]::before {
  -webkit-mask-image: var(--icon-users);
  mask-image: var(--icon-users);
}

.nav-btn[data-page="patientAssignment"]::before {
  -webkit-mask-image: var(--icon-user-plus);
  mask-image: var(--icon-user-plus);
}

.nav-btn[data-page="patientExercises"]::before {
  -webkit-mask-image: var(--icon-note);
  mask-image: var(--icon-note);
}

.nav-btn[data-page="history"]::before {
  -webkit-mask-image: var(--icon-history);
  mask-image: var(--icon-history);
}

.nav-btn[data-page="access"]::before {
  -webkit-mask-image: var(--icon-shield);
  mask-image: var(--icon-shield);
}

.nav-btn[data-page="management"]::before {
  -webkit-mask-image: var(--icon-dashboard);
  mask-image: var(--icon-dashboard);
}

.nav-btn.active {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.105);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent-cyan-soft);
}

.sidebar-user {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: var(--nav-elevated);
}

.sidebar-user::before {
  content: "";
  width: 38px;
  height: 38px;
  grid-row: 1;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background-color: var(--accent-cyan-soft);
  -webkit-mask-image: var(--icon-users);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 20px;
  mask-image: var(--icon-users);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 20px;
}

.sidebar-user-copy {
  min-width: 0;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  color: #fff;
  font-size: 0.79rem;
}

.sidebar-user small {
  margin-top: 1px;
  color: var(--nav-muted);
  font-size: 0.75rem;
}

.sidebar-user .secondary-btn {
  grid-column: 1 / -1;
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: #e5e7eb;
}

.content-area {
  min-width: 0;
  min-height: 100dvh;
}

.content-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(22px, 3vw, 42px);
  border-bottom: 1px solid rgba(228, 231, 236, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.header-title-group {
  flex: 1 1 auto;
  min-width: 0;
}

.content-header .eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
}

.content-header h1 {
  margin: 0;
  overflow: hidden;
  color: var(--ink-strong);
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  min-width: 0;
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.header-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}

.header-pill::before {
  content: "";
  width: 16px;
  height: 16px;
  background-color: var(--muted);
  -webkit-mask-image: var(--icon-calendar);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 16px;
  mask-image: var(--icon-calendar);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 16px;
}

.main-content {
  width: min(1480px, 100%);
  display: grid;
  gap: 20px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 38px);
}

#mainContent[data-view="overview"] {
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  align-items: start;
  align-content: start;
}

#mainContent[data-view="overview"] .metric-grid {
  grid-column: 1 / -1;
}

#mainContent[data-view="overview"] .overview-assignments-card {
  grid-column: 1 / -1;
  width: 100%;
}

/* Controls */
.primary-btn,
.secondary-btn,
.soft-btn,
.success-btn,
.danger-btn,
.warning-btn,
.compact-btn,
.voice-btn,
.voice-done-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease), opacity var(--ease);
}

.primary-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(5, 60, 96, 0.18);
}

.secondary-btn {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-xs);
}

.soft-btn,
.compact-btn,
.voice-btn,
.voice-done-btn {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary-active);
}

.success-btn {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.danger-btn {
  border-color: #fecdca;
  background: var(--surface);
  color: var(--danger);
}

.danger-btn.subtle-danger {
  border-color: transparent;
  background: var(--danger-soft);
}

.warning-btn {
  border-color: var(--warning);
  background: var(--warning);
  color: #fff;
}

.compact-btn {
  min-height: 44px;
  padding: 7px 10px;
  font-size: 0.75rem;
}

.full-width {
  width: 100%;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
.disabled-btn {
  cursor: not-allowed !important;
  opacity: 0.48;
}

label,
.field-label {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink-strong);
  font-size: 0.9rem;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

input,
select {
  padding: 10px 12px;
}

textarea {
  min-height: 104px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(7, 83, 125, 0.16);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-muted);
  box-shadow: none;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
  box-shadow: none;
}

.form-field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.exercise-form {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, auto) auto;
}

.checkbox-card,
.modal-checkbox-card {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.actions-row,
.patient-actions,
.modal-actions,
.portal-dialog-actions,
.note-review-actions,
.voice-note-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.patient-actions {
  justify-content: flex-end;
}

/* Content surfaces */
.card,
.management-panel,
.ta-patient-section,
.patient-workspace,
.staff-assignment-card,
.patient-assignment {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card,
.management-panel,
.ta-patient-section,
.patient-workspace {
  padding: 20px;
}

.card-header,
.section-header,
.panel-header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: -20px -20px 20px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.card-header > div,
.section-header > div,
.panel-header > div {
  min-width: 0;
}

.card-header h2,
.card-header h3,
.section-header h2,
.section-header h3,
.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.card-header p,
.section-header p,
.panel-header p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

.compact-header,
.patient-welcome,
.patient-session-header {
  margin-bottom: 16px;
}

.page-intro-card {
  border-color: var(--primary-line);
  background: var(--surface-subtle);
  box-shadow: none;
}

.page-intro-card .card-header {
  margin-bottom: 0;
  border-bottom: 0;
  background: transparent;
}

.page-intro-card .ta-controls {
  margin-top: 16px;
}

.assignment-page-intro,
.detail-top-card {
  padding-bottom: 0;
}

.assignment-page-intro .card-header,
.detail-top-card .card-header {
  margin-bottom: 0;
}

.section-stack,
.staff-assignment-list,
.patient-note-list,
.note-list,
.recent-list,
.list-view,
.ta-exercise-list {
  display: grid;
  gap: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.metric-card > div {
  min-width: 0;
}

.metric-card p,
.metric-card strong,
.metric-card small {
  display: block;
  margin: 0;
}

.metric-card p {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong {
  margin-top: 2px;
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.metric-card small {
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  width: 22px;
  height: 22px;
  margin: auto;
  color: var(--primary);
}

.metric-card:has(.metric-icon) .metric-icon {
  position: relative;
}

.metric-icon-patients,
.metric-icon-team {
  -webkit-mask-image: var(--icon-users);
  mask-image: var(--icon-users);
}

.metric-icon-sessions {
  -webkit-mask-image: var(--icon-calendar);
  mask-image: var(--icon-calendar);
}

.metric-icon-notes {
  -webkit-mask-image: var(--icon-note);
  mask-image: var(--icon-note);
}

.metric-card::before {
  content: "";
  width: 44px;
  height: 44px;
  grid-column: 1;
  grid-row: 1;
  border-radius: 12px;
  background: var(--primary-soft);
}

.metric-card .metric-icon {
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
}

.badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.badge.soft {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary-active);
}

.badge.ok {
  border-color: #a6f4c5;
  background: var(--success-soft);
  color: var(--success);
}

.badge.warn {
  border-color: #fedf89;
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.danger {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  min-height: 124px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  text-align: center;
}

.empty-state::before {
  content: "";
  width: 26px;
  height: 26px;
  background-color: var(--muted-light);
  -webkit-mask-image: var(--icon-note);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: var(--icon-note);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.table-wrap,
.history-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  scrollbar-color: var(--line-strong) transparent;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.history-table {
  min-width: 980px;
}

.overview-assignments-card table {
  min-width: 620px;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--ink-soft);
}

td strong {
  font-weight: 600;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.list-toolbar,
.history-tools {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.search-control {
  display: grid;
  gap: 7px;
}

.search-inline {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
}

.filter-row,
.history-filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
}

.toolbar-result-note {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.75rem;
}

.patient-history-results {
  margin-top: 18px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.pagination > span {
  font-size: 0.78rem;
  text-align: center;
}

.list-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease);
}

.row-main,
.row-open-button {
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.row-main > span:last-child {
  min-width: 0;
}

.row-main strong,
.row-main small {
  display: block;
}

.row-main strong {
  font-size: 0.88rem;
}

.row-main small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.row-avatar,
.staff-assignment-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.row-avatar {
  width: 42px;
  height: 42px;
  font-size: 0.8rem;
}

.row-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.note-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.note-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.note-card-top strong {
  font-size: 0.86rem;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 5px 0 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.note-body {
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.note-body .note-report-name,
.note-body .note-structured-label {
  color: var(--ink);
  font-size: inherit;
  font-weight: 800;
}

.patient-pace-review {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.patient-pace-review strong {
  color: var(--ink);
  font-size: inherit;
  font-weight: 800;
}

/* Management */
.management-panel {
  box-shadow: none;
}

.collapsed-content {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.switch-control {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  user-select: none;
}

.switch-slider {
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 40px;
  border-radius: 999px;
  background: #d0d5dd;
  transition: background-color var(--ease);
}

.switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.28);
  transition: transform var(--ease);
}

.switch-slider.is-active {
  background: var(--success);
}

.switch-slider.is-active::after {
  transform: translateX(18px);
}

.switch-control:focus-visible .switch-slider {
  outline: 3px solid rgba(7, 83, 125, 0.38);
  outline-offset: 2px;
}

.switch-text {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Care-staff workbench */
.ta-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.ta-controls .form-field {
  width: min(240px, 100%);
}

.ta-patient-section {
  box-shadow: var(--shadow-xs);
}

.ta-section-body {
  display: grid;
  gap: 18px;
}

.ta-section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.exercise-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) minmax(210px, 0.75fr) minmax(260px, 1.2fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.note-view-stack {
  display: grid;
  gap: 8px;
}

.readonly-note {
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.compact-readonly-note {
  min-height: 44px;
}

.readonly-history-meta-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.readonly-detail-block {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.readonly-detail-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.readonly-detail-value {
  color: var(--ink-strong);
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.provider-history-note-row,
.readonly-exercise-row,
.history-view-note-row {
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr);
}

.readonly-exercise-summary {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) minmax(170px, 1fr);
  gap: 10px;
}

.staff-only-note-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.staff-only-note-section label,
.staff-note-label {
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.staff-only-note-section textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  background: var(--surface);
}

.doctor-note-section {
  border-color: var(--primary-line);
  background: var(--primary-soft);
}

.staff-note-readonly {
  min-height: 58px;
  background: var(--surface);
  white-space: pre-wrap;
}

.staff-note-helper {
  color: var(--muted);
  font-size: 0.75rem;
}

.session-status-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.session-status-section label,
.session-status-label {
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.session-status-section select {
  width: min(320px, 100%);
  background: var(--surface);
}

.session-status-helper {
  color: var(--muted);
  font-size: 0.75rem;
}

.readonly-session-status {
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  align-items: center;
}

.session-status-readonly {
  display: flex;
  align-items: center;
}

.patient-actions {
  padding-top: 2px;
}

/* Admin assignment */
.staff-assignment-card {
  box-shadow: var(--shadow-xs);
}

.staff-assignment-card.open {
  border-color: var(--primary-line);
  box-shadow: 0 0 0 1px rgba(7, 83, 125, 0.05), var(--shadow-sm);
}

.staff-assignment-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  background: var(--surface);
}

.staff-assignment-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.staff-assignment-avatar {
  width: 44px;
  height: 44px;
  font-size: 0.75rem;
}

.staff-assignment-identity h3 {
  margin: 0 0 4px;
  font-size: 0.93rem;
}

.assignment-role-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
}

.staff-assignment-body {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.assignment-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.assignment-toolbar-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr);
  gap: 12px;
}

.assigned-patient-selector-list {
  display: grid;
  gap: 8px;
}

.assigned-patient-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(200px, 1fr) minmax(130px, 0.38fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.assigned-patient-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  align-self: end;
  margin-bottom: 4px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.78rem;
  font-weight: 700;
}

.assigned-patient-delete {
  align-self: end;
}

.assignment-saved-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 0;
  font-size: 0.78rem;
}

/* Admin patient exercises */
.patient-exercise-columns {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.25fr);
  gap: 14px;
  align-items: start;
}

.patient-exercise-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.patient-exercise-panel-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.patient-exercise-panel-heading > div {
  min-width: 0;
}

.patient-exercise-panel-heading h4,
.patient-exercise-panel-heading p {
  margin: 0;
}

.patient-exercise-panel-heading h4 {
  font-size: 0.92rem;
}

.patient-exercise-panel-heading p {
  margin-top: 3px;
  font-size: 0.78rem;
}

.current-exercise-meta {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.current-exercise-history-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.current-exercise-help {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--primary-soft);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

.current-exercise-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.current-exercise-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(88px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 600;
}

.current-exercise-duration {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: 1px solid var(--primary-line);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.exercise-total-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.exercise-total-summary strong {
  color: var(--primary-active);
  font-size: 0.84rem;
  white-space: nowrap;
}

.compact-empty-state {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.patient-exercise-date-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(190px, 0.58fr) minmax(0, 1.42fr);
  gap: 12px;
  align-items: end;
}

.locked-date-input[readonly] {
  border-color: var(--primary-line);
  background: linear-gradient(135deg, rgba(225, 247, 249, 0.84), rgba(255, 255, 255, 0.62));
  color: var(--primary-active);
  font-weight: 700;
  cursor: default;
}

.locked-date-display {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(225, 247, 249, 0.84), rgba(255, 255, 255, 0.62));
  color: var(--primary-active);
  font-size: 0.82rem;
  font-weight: 700;
}

.patient-exercise-schedule {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.patient-exercise-notice {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.patient-exercise-notice > div {
  min-width: 0;
}

.patient-exercise-notice strong,
.patient-exercise-notice p {
  margin: 0;
}

.patient-exercise-notice p {
  margin-top: 3px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.patient-exercise-notice.warning-notice {
  border-color: rgba(146, 64, 14, 0.24);
  background: var(--warning-soft);
}

.patient-exercise-notice.danger-notice {
  border-color: rgba(180, 35, 24, 0.24);
  background: var(--danger-soft);
}

.patient-exercise-option-list {
  display: grid;
  gap: 4px;
}

.patient-exercise-option {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(112px, 0.32fr) minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease);
}

.patient-exercise-option.selected {
  border-color: var(--primary-line);
  background: rgba(12, 181, 203, 0.1);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.patient-exercise-option.is-disabled {
  background: var(--surface-muted);
}

.patient-exercise-duration-field {
  gap: 0;
}

.patient-exercise-duration-field label {
  font-size: 0.74rem;
}

.patient-exercise-choice {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.patient-exercise-choice input {
  flex: 0 0 18px;
}

.patient-exercise-choice span,
.patient-exercise-choice strong,
.patient-exercise-choice small {
  min-width: 0;
  display: block;
}

.patient-exercise-choice strong {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.patient-exercise-choice small {
  margin-top: 2px;
  color: var(--warning);
  font-size: 0.7rem;
}

.patient-exercise-option.is-disabled .patient-exercise-choice {
  cursor: not-allowed;
}

.patient-exercise-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.patient-exercise-save-row p {
  margin: 0;
  font-size: 0.76rem;
}

/* Patient workspace */
.patient-workspace {
  display: grid;
  gap: 16px;
}

.patient-assignment {
  padding: 18px;
  box-shadow: none;
}

.patient-assignment .section-header {
  margin: -18px -18px 18px;
  padding: 15px 18px;
}

.patient-note-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.exercise-number {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-top: 23px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.86rem;
  font-weight: 700;
}

.note-input-block {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.note-input-block textarea {
  min-height: 112px;
  background: var(--surface);
}

.voice-note-controls {
  min-height: 38px;
}

.voice-btn,
.voice-done-btn {
  min-height: 44px;
  padding: 7px 11px;
}

.mic-only-btn {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.mic-icon {
  width: 16px;
  height: 16px;
  display: block;
  overflow: hidden;
  background-color: currentColor;
  color: transparent;
  font-size: 0;
  -webkit-mask-image: var(--icon-mic);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: var(--icon-mic);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.voice-btn.recording {
  border-color: #fda29b;
  background: var(--danger-soft);
  color: var(--danger);
}

.recording-indicator {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f04438;
  animation: recordingPulse 1.4s ease-in-out infinite;
}

@keyframes recordingPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.78);
  }
}

/* Dialogs and feedback */
.modal-backdrop,
.portal-dialog-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: rgba(15, 23, 42, 0.62);
  animation: backdropIn 160ms ease-out both;
}

.modal-card,
.portal-dialog-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: hidden auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: dialogIn 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.compact-modal {
  width: min(520px, 100%);
}

.note-edit-modal {
  width: min(640px, 100%);
}

.modal-header,
.portal-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.modal-header h3,
.modal-header h2,
.portal-dialog-header h2,
.portal-dialog-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-header p,
.portal-dialog-header p {
  margin: 4px 0 0;
  font-size: 0.78rem;
}

.modal-body,
.portal-dialog-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.modal-form-field {
  display: grid;
  gap: 7px;
}

.modal-actions,
.portal-dialog-actions {
  justify-content: flex-end;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.modal-x {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 10px;
}

.portal-dialog-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.portal-dialog-icon,
.modal-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 1rem;
  font-weight: 700;
}

.danger-dialog .portal-dialog-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.note-dialog-icon {
  color: transparent;
  font-size: 0;
}

.note-dialog-icon::before {
  content: "";
  width: 18px;
  height: 18px;
  background-color: var(--primary);
  -webkit-mask-image: var(--icon-pencil);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: var(--icon-pencil);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.portal-dialog-message {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.6;
}

.toast {
  position: fixed;
  z-index: 2000;
  right: 22px;
  bottom: 22px;
  width: min(400px, calc(100vw - 32px));
  padding: 13px 15px 13px 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: var(--ink-strong);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity var(--ease), transform var(--ease);
}

.toast::before {
  content: "i";
  position: absolute;
  top: 50%;
  left: 16px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent-cyan-soft);
  border-radius: 50%;
  color: var(--accent-cyan-soft);
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding-top: 1px;
  text-align: center;
  transform: translateY(-50%);
}

.toast::after {
  content: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (hover: hover) and (pointer: fine) {
  .nav-btn:hover {
    background: rgba(255, 255, 255, 0.065);
    color: #fff;
  }

  .primary-btn:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
  }

  .secondary-btn:hover {
    border-color: #98a2b3;
    background: var(--surface-subtle);
    color: var(--ink-strong);
  }

  .soft-btn:hover,
  .compact-btn:hover,
  .voice-btn:hover,
  .voice-done-btn:hover {
    border-color: var(--primary-line);
    background: var(--surface-subtle);
  }

  .success-btn:hover {
    border-color: var(--success-hover);
    background: var(--success-hover);
  }

  .danger-btn:hover {
    border-color: #fda29b;
    background: var(--danger-soft);
    color: var(--danger-hover);
  }

  .warning-btn:hover {
    border-color: var(--warning-hover);
    background: var(--warning-hover);
  }

  .list-row:hover {
    border-color: var(--primary-line);
    background: var(--surface-subtle);
    box-shadow: var(--shadow-xs);
  }

  tbody tr:hover td {
    background: var(--surface-subtle);
  }
}

/* Responsive */
@media (max-width: 1280px) {
  #mainContent[data-view="overview"] {
    grid-template-columns: 1fr;
  }

  #mainContent[data-view="overview"] .metric-grid {
    grid-column: auto;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .form-grid > button {
    align-self: end;
  }

  .exercise-row {
    grid-template-columns: minmax(120px, 0.4fr) minmax(210px, 0.8fr);
  }

  .exercise-row .note-review-field {
    grid-column: 1 / -1;
  }

  .provider-history-note-row,
  .readonly-exercise-row,
  .history-view-note-row {
    grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr);
  }

  .provider-history-note-row .note-review-field,
  .readonly-exercise-row .note-review-field,
  .history-view-note-row .note-review-field {
    grid-column: auto;
  }
}

@media (max-width: 1024px) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.86fr);
  }

  .auth-story,
  .login-card {
    padding: 42px;
  }

  .auth-story-copy h1,
  .auth-story-copy h2 {
    font-size: clamp(2.4rem, 5vw, 3.35rem);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 18px;
    padding: 14px 20px 12px;
    overflow: visible;
  }

  .sidebar-brand {
    margin: 0;
    padding: 0;
  }

  .nav-section-label {
    display: none;
  }

  .side-nav {
    width: 100%;
    max-width: 100%;
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }

  .nav-btn {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .sidebar-user {
    min-width: 0;
    grid-column: 3;
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .sidebar-user::before {
    display: none;
  }

  .sidebar-user .secondary-btn {
    min-height: 44px;
  }

  .content-header {
    min-height: 78px;
  }

  .main-content {
    padding: 24px;
  }

  .ta-section-grid,
  .readonly-history-meta-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .assigned-patient-row {
    grid-template-columns: 38px minmax(190px, 1fr) minmax(130px, 0.45fr);
  }

  .assigned-patient-delete {
    grid-column: 2 / -1;
    justify-self: end;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .auth-screen {
    display: block;
    padding: 0;
  }

  .auth-layout {
    width: 100%;
    min-height: 100dvh;
    display: block;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-story {
    min-height: auto;
    padding: 28px 24px 34px;
  }

  .auth-story-copy {
    margin: 56px 0 28px;
  }

  .auth-story-copy h1,
  .auth-story-copy h2 {
    max-width: 520px;
    font-size: clamp(2.35rem, 11vw, 3.25rem);
  }

  .auth-feature-list {
    grid-template-columns: 1fr;
  }

  .auth-feature {
    padding: 11px 12px;
  }

  .auth-story-foot {
    display: none;
  }

  .login-card {
    min-height: auto;
    padding: 42px 24px 52px;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 16px 10px;
  }

  .sidebar-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .sidebar-user {
    grid-column: 2;
    grid-row: 1;
  }

  .sidebar-user-copy {
    display: none;
  }

  .side-nav {
    grid-column: 1 / -1;
  }

  .nav-btn {
    min-height: 44px;
    padding: 9px 11px;
    font-size: 0.8rem;
  }

  .content-header {
    min-height: 72px;
    padding: 13px 18px;
  }

  .header-pill {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 0.75rem;
  }

  .main-content {
    gap: 16px;
    padding: 18px;
  }

  .card,
  .management-panel,
  .ta-patient-section,
  .patient-workspace {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .card-header,
  .section-header,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: -16px -16px 16px;
    padding: 15px 16px;
  }

  .card-header .actions-row,
  .section-header .actions-row,
  .panel-header .actions-row {
    justify-content: flex-start;
  }

  .card-header > .badge,
  .section-header > .badge,
  .panel-header > .badge {
    align-self: flex-start;
  }

  .metric-grid,
  .form-grid,
  .exercise-form,
  .filter-row,
  .history-filter-row,
  .ta-section-grid,
  .readonly-history-meta-grid {
    grid-template-columns: 1fr;
  }

  .search-inline {
    grid-template-columns: 1fr auto auto;
  }

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

  .row-actions {
    justify-content: flex-start;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .exercise-row,
  .provider-history-note-row,
  .readonly-exercise-row,
  .history-view-note-row {
    grid-template-columns: 1fr;
  }

  .exercise-row .note-review-field,
  .provider-history-note-row .note-review-field,
  .readonly-exercise-row .note-review-field,
  .history-view-note-row .note-review-field {
    grid-column: auto;
  }

  .readonly-exercise-summary {
    grid-template-columns: 1fr 1fr;
  }

  .staff-assignment-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .assignment-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .assignment-toolbar-fields {
    grid-template-columns: 1fr 1fr;
  }

  .assigned-patient-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .assigned-patient-time-field {
    grid-column: 2;
  }

  .assigned-patient-delete {
    grid-column: 2;
    justify-self: start;
  }

  .patient-assignment {
    padding: 16px;
  }

  .patient-assignment .section-header {
    margin: -16px -16px 16px;
    padding: 15px 16px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination > span {
    order: -1;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .auth-story {
    padding: 18px 20px;
  }

  .auth-story-copy,
  .auth-feature-list,
  .auth-story-foot {
    display: none;
  }

  .auth-story-copy {
    margin-top: 42px;
  }

  .auth-story-copy > p:last-child {
    font-size: 0.95rem;
  }

  .login-card-header h1,
  .login-card-header h2 {
    font-size: 1.75rem;
  }

  .login-card {
    padding-top: 34px;
  }

  .sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .sidebar-brand strong {
    font-size: 0.94rem;
  }

  .content-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .content-header h1 {
    font-size: 1.25rem;
  }

  .header-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main-content {
    padding: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .search-inline {
    grid-template-columns: 1fr 1fr;
  }

  .search-inline input {
    grid-column: 1 / -1;
  }

  .search-inline button {
    width: 100%;
  }

  .actions-row {
    align-items: stretch;
  }

  .row-actions > button {
    flex: 1 1 auto;
  }

  .assignment-toolbar-fields {
    grid-template-columns: 1fr;
  }

  .assigned-patient-row {
    grid-template-columns: 1fr;
  }

  .assigned-patient-number,
  .assigned-patient-field,
  .assigned-patient-time-field,
  .assigned-patient-delete {
    grid-column: 1;
  }

  .assigned-patient-delete {
    width: 100%;
  }

  .patient-note-row {
    grid-template-columns: 1fr;
  }

  .exercise-number {
    width: 34px;
    height: 34px;
    margin: 0;
  }

  .readonly-exercise-summary {
    grid-template-columns: 1fr;
  }

  .modal-backdrop,
  .portal-dialog-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal-card,
  .portal-dialog-card {
    width: 100%;
    max-height: 90dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .modal-actions > button,
  .portal-dialog-actions > button {
    flex: 1 1 120px;
  }

  .toast {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 2026 workspace navigation, patient master/detail, and access control */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sidebar-topbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.sidebar-topbar .sidebar-brand {
  min-width: 0;
  margin: 0;
  padding: 0 6px;
}

.sidebar-brand-copy {
  min-width: 0;
}

.sidebar-collapse-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: background-color var(--ease), border-color var(--ease), box-shadow var(--ease);
}

.sidebar-collapse-btn svg,
.logout-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-user .secondary-btn {
  gap: 8px;
}

.logout-icon {
  width: 18px;
  height: 18px;
}

@media (hover: hover) and (pointer: fine) {
  .sidebar-collapse-btn:hover {
    border-color: rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.15);
  }
}

@media (min-width: 1025px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .sidebar.is-collapsed {
    padding-inline: 12px;
  }

  .sidebar.is-collapsed .sidebar-topbar {
    display: flex;
    justify-content: center;
  }

  .sidebar.is-collapsed .sidebar-brand,
  .sidebar.is-collapsed .nav-section-label,
  .sidebar.is-collapsed .nav-label,
  .sidebar.is-collapsed .sidebar-user-copy,
  .sidebar.is-collapsed .logout-label {
    display: none;
  }

  .sidebar.is-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }

  .sidebar.is-collapsed .nav-btn {
    justify-content: center;
    padding-inline: 0;
  }

  .sidebar.is-collapsed .nav-btn.active {
    box-shadow: inset 0 -3px 0 var(--accent-cyan-soft);
  }

  .sidebar.is-collapsed .sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .sidebar.is-collapsed .sidebar-user::before {
    flex: 0 0 38px;
  }

  .sidebar.is-collapsed .sidebar-user .secondary-btn {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }
}

/* Shared tab treatment */
.workspace-tabs {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.workspace-tab {
  position: relative;
  min-width: 0;
  min-height: 48px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 0;
  border-radius: 9px 9px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color var(--ease), color var(--ease);
}

.workspace-tab::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

.workspace-tab.active {
  background: var(--surface-subtle);
  color: var(--primary-active);
}

.workspace-tab.active::after {
  background: var(--primary);
}

.tab-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.tab-icon-notes,
.tab-icon-exercises,
.access-tab-icon-audit {
  -webkit-mask-image: var(--icon-note);
  mask-image: var(--icon-note);
}

.access-tab-icon-create {
  -webkit-mask-image: var(--icon-user-plus);
  mask-image: var(--icon-user-plus);
}

.access-tab-icon-permissions {
  -webkit-mask-image: var(--icon-shield);
  mask-image: var(--icon-shield);
}

@media (hover: hover) and (pointer: fine) {
  .workspace-tab:hover {
    background: var(--surface-subtle);
    color: var(--ink-strong);
  }
}

/* Patient directory master/detail */
#mainContent[data-view="patients"] {
  width: min(1540px, 100%);
}

.patient-directory-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(250px, 292px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.patient-list-pane,
.patient-detail-pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.patient-list-pane {
  overflow: hidden;
}

.patient-list-pane-header,
.patient-detail-header,
.patient-panel-intro,
.access-section-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.patient-list-pane-header {
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.patient-list-pane-header .eyebrow,
.patient-detail-header .eyebrow,
.access-section-heading .eyebrow {
  margin-bottom: 3px;
}

.patient-list-pane-header h2,
.patient-detail-header h2,
.patient-panel-intro h3,
.access-section-heading h3 {
  margin: 0;
}

.patient-list-pane-header h2 {
  font-size: 1rem;
}

.patient-rail-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.patient-search-field {
  position: relative;
  min-width: 0;
}

.patient-search-field input {
  width: 100%;
  padding-left: 37px;
}

.patient-search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
  transform: translateY(-54%);
}

.patient-search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--muted);
  transform: rotate(45deg);
}

.patient-rail-search .compact-btn {
  min-height: 44px;
  padding-inline: 11px;
}

.patient-search-clear {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 28px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--primary-active);
  font-size: 0.75rem;
  font-weight: 700;
}

.patient-rail-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.patient-rail-item {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 14px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  transition: background-color var(--ease), border-color var(--ease), box-shadow var(--ease);
}

.patient-rail-item .row-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.patient-rail-copy,
.patient-rail-copy strong,
.patient-rail-copy small {
  min-width: 0;
  display: block;
}

.patient-rail-copy strong,
.patient-rail-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-rail-copy strong {
  margin-bottom: 2px;
  font-size: 0.84rem;
}

.patient-rail-copy small {
  color: var(--muted);
  font-size: 0.72rem;
}

.patient-rail-chevron,
.accordion-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  color: var(--muted);
  transform: rotate(-45deg);
}

.patient-rail-item.selected {
  border-color: var(--primary-line);
  background: var(--surface-subtle);
  box-shadow: inset 3px 0 0 var(--primary);
}

.patient-rail-item.selected .patient-rail-chevron {
  color: var(--primary-active);
}

@media (hover: hover) and (pointer: fine) {
  .patient-rail-item:hover {
    border-color: var(--line-strong);
    background: var(--surface-subtle);
  }
}

.patient-detail-pane {
  overflow: hidden;
}

.patient-detail-header {
  min-height: 92px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.patient-detail-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.patient-detail-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--primary-line);
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.88rem;
  font-weight: 800;
}

.patient-detail-header h2 {
  font-size: 1.18rem;
}

.patient-detail-meta,
.patient-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.patient-detail-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.77rem;
}

.patient-detail-actions {
  justify-content: flex-end;
}

.patient-detail-actions .danger-btn {
  min-height: 40px;
}

.patient-detail-pane > .workspace-tabs {
  padding: 0 14px;
  background: var(--surface);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.patient-detail-pane > .workspace-tabs::-webkit-scrollbar {
  display: none;
}

.patient-tab-panel {
  min-width: 0;
  padding: 20px;
}

.patient-panel-intro {
  align-items: flex-start;
  margin-bottom: 18px;
}

.patient-panel-intro h3 {
  font-size: 1rem;
}

.patient-panel-intro p {
  margin: 4px 0 0;
  font-size: 0.8rem;
}

.patient-note-filters {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.patient-notes-panel .patient-history-results {
  margin-top: 16px;
}

.patient-exercise-workspace,
.patient-notes-panel {
  min-width: 0;
}

.patient-exercise-columns.read-only {
  grid-template-columns: minmax(0, 760px);
}

.patient-detail-empty,
.access-empty-state {
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.patient-detail-empty h2,
.access-empty-state h2 {
  margin: 16px 0 6px;
  font-size: 1.1rem;
}

.patient-detail-empty p,
.access-empty-state p {
  max-width: 460px;
  margin: 0;
}

.patient-detail-empty-icon,
.access-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background-color: var(--primary-active);
  background-image: none;
  -webkit-mask-image: var(--icon-users);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 36px;
  mask-image: var(--icon-users);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 36px;
  opacity: 0.74;
}

/* Access Control */
#mainContent[data-view="access"] {
  width: min(1360px, 100%);
}

.access-control-shell {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.access-control-intro {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.access-control-intro h2 {
  margin: 0;
  font-size: 1.28rem;
}

.access-control-intro p:last-child {
  max-width: 690px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.access-summary {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.access-summary span {
  min-width: 98px;
  display: grid;
  gap: 1px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
}

.access-summary strong {
  font-size: 1rem;
}

.access-tabs {
  padding-inline: 18px;
  background: var(--surface);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.access-tabs::-webkit-scrollbar {
  display: none;
}

.access-tab-panel {
  min-width: 0;
  padding: 24px;
}

.registration-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(360px, 1.28fr);
  gap: 22px;
  align-items: stretch;
}

.registration-guidance,
.registration-form {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.registration-guidance {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background: var(--nav-gradient);
  color: #fff;
}

.registration-guidance::after {
  content: "";
  position: absolute;
  right: -92px;
  bottom: -110px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.registration-guidance-icon {
  width: 46px;
  height: 46px;
  display: block;
  margin-bottom: 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 13px;
  background-color: var(--accent-cyan-soft);
  -webkit-mask-image: var(--icon-user-plus);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 24px;
  mask-image: var(--icon-user-plus);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 24px;
}

.registration-guidance .eyebrow {
  color: var(--accent-cyan-soft);
}

.registration-guidance h3 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 1.25rem;
}

.registration-guidance > p:not(.eyebrow),
.registration-guidance li {
  color: var(--nav-muted);
  font-size: 0.83rem;
}

.registration-guidance ul {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin: 22px 0 0;
  padding-left: 19px;
}

.registration-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
  padding: 22px;
  background: var(--surface);
}

.registration-type-field,
.registration-submit,
.registration-checkbox {
  grid-column: 1 / -1;
}

.registration-submit {
  justify-self: start;
  min-width: 190px;
  margin-top: 2px;
}

.registration-checkbox span,
.registration-checkbox strong,
.registration-checkbox small {
  display: block;
}

.registration-checkbox small,
.field-help {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.permissions-layout {
  min-width: 0;
}

.access-section-heading {
  align-items: flex-end;
  margin-bottom: 8px;
}

.access-section-heading h3 {
  font-size: 1.08rem;
}

.access-section-heading p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.access-page-count {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.exercise-section-heading {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.access-category-list,
.access-category-body {
  display: grid;
  gap: 0;
}

.access-category,
.access-record {
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.access-category-list,
.exercise-category {
  border-top: 1px solid var(--line);
}

.access-category > summary,
.access-record > summary {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--ease), color var(--ease);
}

.access-category > summary::-webkit-details-marker,
.access-record > summary::-webkit-details-marker {
  display: none;
}

.access-category > summary {
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr) 12px;
  padding: 4px 6px;
  background: transparent;
}

.access-category > summary strong,
.access-category > summary small,
.access-record > summary strong,
.access-record > summary small {
  min-width: 0;
  display: block;
}

.access-category > summary strong {
  font-size: 0.88rem;
}

.access-category > summary small,
.access-record > summary small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-category[open] > summary,
.access-record[open] > summary {
  border-bottom: 1px solid var(--line);
}

.access-category[open] > summary .accordion-chevron,
.access-record[open] > summary .accordion-chevron {
  transform: rotate(45deg);
}

.access-category-body {
  padding: 0 0 0 10px;
  background: transparent;
}

.access-record {
  box-shadow: none;
}

.access-record > summary {
  min-height: 44px;
  grid-template-columns: minmax(150px, 1fr) auto auto 12px;
  padding: 4px 6px;
}

.access-record-copy {
  min-width: 0;
}

.access-record-copy strong {
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-record-count {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  white-space: nowrap;
}

.access-record-body {
  padding: 0 0 4px;
  background: transparent;
}

.permission-account-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}

.permission-account-toolbar h4 {
  margin: 0;
  font-size: 0.9rem;
}

.permission-account-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.permission-groups {
  display: block;
}

.permission-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(145px, 0.22fr) minmax(0, 1fr);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.permission-group:last-child {
  border-bottom: 0;
}

.permission-group-heading {
  min-width: 0;
  padding: 8px 6px;
  border-right: 1px solid var(--line);
}

.permission-group-heading strong,
.permission-group-heading code {
  min-width: 0;
  display: block;
}

.permission-group-heading strong {
  color: var(--ink-strong);
  font-size: 0.76rem;
  font-weight: 800;
}

.permission-group-heading code {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.61rem;
  overflow-wrap: anywhere;
}

.permission-check-list,
.exercise-setting-list {
  display: grid;
  gap: 0;
}

.permission-check-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.permission-check {
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 3px 6px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease);
}

.permission-check input {
  margin: 0;
}

.permission-check span,
.permission-check strong,
.permission-check small {
  min-width: 0;
  display: block;
}

.permission-check strong {
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.25;
}

.permission-check code,
.permission-check small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.59rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.permission-check:has(input:checked) {
  background: var(--primary-soft);
}

.permission-check.page-permission {
  box-shadow: inset 3px 0 0 var(--primary-active);
}

.permission-check.risk-permission:has(input:checked) {
  background: var(--danger-soft);
}

.permission-check:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.68;
}

.permission-safeguard {
  margin: 4px 6px;
  padding: 6px 8px;
  border: 0;
  border-left: 3px solid #fdb022;
  border-radius: 0;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.72rem;
}

.exercise-access-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
}

.exercise-setting-list {
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.exercise-access-actions {
  flex: 0 0 auto;
}

.audit-placeholder {
  min-height: 470px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  text-align: center;
}

.audit-placeholder-icon {
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border: 1px solid var(--primary-line);
  border-radius: 18px;
  background-color: var(--primary-active);
  -webkit-mask-image: var(--icon-history);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 34px;
  mask-image: var(--icon-history);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 34px;
}

.audit-placeholder h3 {
  margin: 16px 0 8px;
  font-size: 1.18rem;
}

.audit-placeholder > p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.audit-scope {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 22px 0;
}

.audit-scope span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 700;
}

.audit-placeholder .audit-note {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
}

@media (hover: hover) and (pointer: fine) {
  .access-category > summary:hover,
  .access-record > summary:hover,
  .permission-check:hover {
    background: var(--surface-muted);
  }
}

.access-category > summary:focus-visible,
.access-record > summary:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

@media (max-width: 1180px) {
  .patient-exercise-columns {
    grid-template-columns: 1fr;
  }

  .permission-check-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .sidebar-topbar {
    grid-column: 1;
    grid-row: 1;
    display: block;
    margin: 0;
  }

  .sidebar-topbar .sidebar-brand {
    padding: 0;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .patient-directory-layout {
    grid-template-columns: minmax(230px, 270px) minmax(0, 1fr);
  }

  .patient-detail-header,
  .access-control-intro {
    align-items: flex-start;
  }

  .patient-detail-header {
    flex-direction: column;
  }

  .patient-detail-actions {
    width: 100%;
    justify-content: space-between;
  }

  .registration-layout {
    grid-template-columns: 1fr;
  }

  .registration-guidance {
    min-height: 260px;
  }
}

@media (max-width: 820px) {
  .patient-directory-layout {
    grid-template-columns: 1fr;
  }

  .patient-rail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .patient-detail-empty {
    min-height: 260px;
  }

  .access-control-intro {
    flex-direction: column;
  }

  .access-summary {
    width: 100%;
  }

  .access-summary span {
    flex: 1 1 0;
  }

  .exercise-access-body,
  .permission-account-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .exercise-setting-list {
    grid-template-columns: 1fr;
  }

  .permission-group {
    grid-template-columns: 1fr;
  }

  .permission-group-heading {
    padding-block: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 600px) {
  .patient-rail-list {
    grid-template-columns: 1fr;
  }

  .patient-detail-header,
  .patient-tab-panel,
  .access-tab-panel,
  .access-control-intro {
    padding: 16px;
  }

  .patient-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .patient-detail-actions > * {
    width: 100%;
  }

  .patient-detail-pane > .workspace-tabs,
  .access-tabs {
    padding-inline: 8px;
  }

  .workspace-tab {
    padding-inline: 12px;
  }

  .registration-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .registration-form > * {
    grid-column: 1;
  }

  .registration-submit {
    width: 100%;
  }

  .access-record > summary {
    grid-template-columns: minmax(0, 1fr) 12px;
  }

  .permission-check-list {
    grid-template-columns: 1fr;
  }

  .access-record > summary > .badge,
  .access-record-count {
    display: none;
  }

  .permission-account-toolbar .actions-row,
  .exercise-access-actions {
    width: 100%;
  }

  .permission-account-toolbar .actions-row > *,
  .exercise-access-actions > * {
    flex: 1 1 0;
  }

  .audit-placeholder {
    min-height: 400px;
    padding: 24px 16px;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .content-header {
    background: var(--surface);
  }
}

/* Premium clinical workspace refinements */
html,
body {
  background: var(--canvas);
}

body {
  line-height: 1.55;
}

::selection {
  background: rgba(121, 228, 240, 0.68);
  color: var(--ink-strong);
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline-color: var(--focus);
}

.main-content:focus-visible {
  outline: none;
}

/* Authentication */
.auth-screen {
  place-items: center;
  padding: clamp(24px, 4vw, 52px);
  background: var(--canvas);
}

.auth-layout {
  width: min(520px, 100%);
  min-height: 0;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-story {
  display: none;
  min-width: 0;
  padding: clamp(40px, 4.5vw, 60px);
  background: var(--nav-gradient);
}

.auth-story::before {
  opacity: 0.12;
  background-image: radial-gradient(rgba(255, 255, 255, 0.72) 0.7px, transparent 0.8px);
  background-size: 24px 24px;
}

.auth-story::after {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 62px rgba(255, 255, 255, 0.025),
    0 0 0 124px rgba(255, 255, 255, 0.016);
}

.auth-story .brand-icon,
.sidebar-brand .brand-icon {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--surface);
  color: var(--primary-active);
  box-shadow: 0 8px 20px rgba(4, 42, 87, 0.2);
}

.auth-brand small,
.auth-story-copy > p:last-child,
.auth-feature small {
  color: var(--nav-muted);
}

.auth-story-copy {
  max-width: 540px;
  margin: auto 0 32px;
}

.auth-story-copy h1,
.auth-story-copy h2 {
  max-width: 520px;
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(2.5rem, 4.4vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.052em;
  line-height: 1.04;
}

.auth-story-copy > p:last-child {
  max-width: 520px;
  font-size: 1rem;
  line-height: 1.7;
}

.auth-story .product-kicker,
.feature-icon {
  color: var(--accent-cyan-soft);
}

.auth-feature-list {
  gap: 8px;
}

.auth-feature {
  padding: 12px 13px;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(4, 42, 87, 0.24);
}

.auth-feature strong {
  font-weight: 600;
}

.login-card {
  min-width: 0;
  min-height: min(680px, calc(100dvh - 64px));
  padding: clamp(40px, 5vw, 56px);
  background: var(--surface);
}

.login-brand {
  display: flex;
}

.login-card-header {
  margin-bottom: 28px;
}

.login-card-header h1,
.login-card-header h2 {
  margin-bottom: 10px;
  font-size: clamp(1.85rem, 3vw, 2.25rem);
  font-weight: 700;
}

.login-form {
  gap: 18px;
}

.login-field {
  gap: 7px;
}

.role-preview,
.login-help {
  border-color: var(--line);
  background: var(--surface-subtle);
  box-shadow: none;
}

.login-help {
  margin-top: 24px;
}

.login-help code {
  border-color: var(--line);
  background: var(--surface);
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  transition:
    background-color var(--ease),
    color var(--ease),
    box-shadow var(--ease);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-eye-closed,
.password-toggle[aria-pressed="true"] .password-eye-open {
  display: none;
}

.password-toggle[aria-pressed="true"] .password-eye-closed {
  display: block;
}

.password-toggle[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary-active);
}

.field-error {
  display: block;
  margin: 0;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
}

.field-error:empty {
  display: none;
}

.login-privacy-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
  text-align: center;
}

/* Application shell */
.app-shell {
  grid-template-columns: 256px minmax(0, 1fr);
  background: var(--canvas);
}

.content-area {
  background: transparent;
}

.sidebar {
  isolation: isolate;
  top: 0;
  height: 100vh;
  height: 100dvh;
  gap: 8px;
  margin: 0;
  padding: 26px 18px 20px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--nav-gradient);
  box-shadow: 8px 0 28px rgba(4, 42, 87, 0.11);
}

.sidebar::before,
.sidebar::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.sidebar::before {
  top: -104px;
  right: -118px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  background-image: radial-gradient(rgba(255, 255, 255, 0.32) 0.7px, transparent 0.8px);
  background-size: 18px 18px;
  box-shadow: 0 0 0 72px rgba(255, 255, 255, 0.025);
}

.sidebar::after {
  bottom: -270px;
  left: -155px;
  width: 240px;
  height: 900px;
  border-right: 1.5px solid rgba(255, 255, 255, 0.11);
  transform: rotate(31deg);
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-brand {
  margin-bottom: 18px;
}

.sidebar-brand .brand-icon {
  box-shadow: 0 6px 16px rgba(4, 42, 87, 0.18);
}

.nav-section-label {
  color: var(--accent-cyan-soft);
  font-weight: 700;
}

.nav-btn {
  border-radius: 10px;
  color: var(--nav-text);
  font-weight: 600;
}

.nav-btn.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent-cyan-soft);
}

:where(.sidebar button, .sidebar a):focus-visible {
  outline-color: var(--accent-cyan-soft);
}

.sidebar-user {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(4, 42, 87, 0.3);
  box-shadow: none;
}

.sidebar-user::before {
  border-color: rgba(255, 255, 255, 0.18);
  background-color: var(--accent-cyan-soft);
}

.sidebar-user .secondary-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: none;
}

.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition:
    background-color var(--ease),
    border-color var(--ease),
    box-shadow var(--ease);
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.mobile-menu-btn[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
}

.content-header {
  top: 0;
  min-height: 80px;
  margin: 0;
  padding: 14px 32px;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.content-header .eyebrow {
  margin-bottom: 3px;
  color: var(--muted);
}

.content-header h1 {
  color: var(--ink-strong);
  font-size: clamp(1.45rem, 2vw, 1.75rem);
  font-weight: 700;
}

.header-pill {
  min-height: 38px;
  padding: 8px 11px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
  box-shadow: none;
}

.header-pill::before {
  background-color: var(--primary-active);
}

.main-content {
  gap: 24px;
  padding: 32px;
}

/* Controls and form states */
input,
select,
textarea {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(7, 83, 125, 0.16);
}

input[type="date"] {
  min-width: 0;
  padding-right: 9px;
  color-scheme: light;
  accent-color: var(--primary);
}

input[type="date"]::-webkit-datetime-edit {
  min-width: 0;
  color: var(--ink-strong);
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

input[type="date"]::-webkit-datetime-edit-text {
  padding-inline: 0.14em;
  color: var(--muted);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  width: 18px;
  height: 18px;
  margin: 0 0 0 8px;
  padding: 4px;
  border-radius: 6px;
  background-color: transparent;
  opacity: 0.72;
  transition: background-color var(--ease), opacity var(--ease);
}

input[type="date"]:not(:disabled):not([readonly]),
input[type="date"]:not(:disabled):not([readonly])::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

input[type="date"]:not(:disabled):not([readonly]):hover {
  border-color: var(--primary-line);
}

input[type="date"]:not(:disabled):not([readonly]):hover::-webkit-calendar-picker-indicator,
input[type="date"]:focus::-webkit-calendar-picker-indicator {
  background-color: var(--primary-soft);
  opacity: 1;
}

:where(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-muted);
}

.locked-date-input[readonly] {
  border-color: var(--primary-line);
  background: var(--surface-subtle);
  color: var(--primary-active);
  box-shadow: none;
}

.primary-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(7, 83, 125, 0.14);
}

.secondary-btn {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: none;
}

.soft-btn,
.compact-btn,
.voice-btn,
.voice-done-btn {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary-active);
  box-shadow: none;
}

button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
}

/* Opaque work surfaces */
.card,
.management-panel,
.ta-patient-section,
.patient-workspace,
.staff-assignment-card,
.patient-assignment {
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card,
.management-panel,
.ta-patient-section,
.patient-workspace {
  padding: 20px;
}

.card-header,
.section-header,
.panel-header {
  gap: 16px;
  margin: -20px -20px 20px;
  padding: 16px 20px;
  border-color: var(--line);
  background: var(--surface-subtle);
}

.card-header h2,
.card-header h3,
.section-header h2,
.section-header h3,
.panel-header h2,
.panel-header h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.modal-header h2,
.modal-header h3,
.portal-dialog-header h2,
.portal-dialog-header h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 1rem;
  font-weight: 700;
}

.page-intro-card {
  border-color: var(--primary-line);
  background: var(--surface-subtle);
  box-shadow: none;
}

.patient-page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  align-items: end;
  gap: 12px;
  padding: 12px 16px;
}

.patient-page-intro .card-header {
  align-self: center;
  margin: 0;
  padding: 0;
}

.patient-page-intro .ta-controls {
  margin: 0;
}

.patient-page-intro .ta-controls .form-field {
  width: 100%;
  gap: 4px;
}

.metric-grid {
  gap: 14px;
}

.metric-card {
  padding: 16px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.metric-card::before,
.row-avatar,
.staff-assignment-avatar,
.assigned-patient-number,
.exercise-number {
  border: 1px solid var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary-active);
}

.empty-state,
.compact-empty-state {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

.table-wrap,
.history-table-wrap,
.list-row,
.note-card,
.exercise-row,
.readonly-note,
.readonly-detail-block,
.staff-assignment-header,
.assignment-toolbar,
.assigned-patient-row,
.note-input-block,
.checkbox-card,
.modal-checkbox-card,
.patient-exercise-panel,
.patient-exercise-option,
.current-exercise-meta,
.current-exercise-item,
.patient-exercise-schedule {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

th {
  background: var(--surface-subtle);
}

td {
  background: var(--surface);
}

.toolbar-result-note,
.current-exercise-help {
  background: var(--surface-subtle);
}

.readonly-exercise-summary {
  background: transparent;
}

.staff-assignment-body,
.modal-actions,
.portal-dialog-actions {
  border-color: var(--line);
  background: var(--surface-subtle);
}

.staff-assignment-card.open {
  border-color: var(--primary-line);
  box-shadow: 0 0 0 1px rgba(7, 83, 125, 0.05), var(--shadow-sm);
}

.patient-exercise-option.selected {
  border-color: var(--primary-line);
  background: var(--surface-subtle);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.history-table {
  min-width: 1040px;
}

.history-table th:last-child,
.history-table td:last-child {
  width: 76px;
  min-width: 76px;
  text-align: center;
}

.history-filter-row {
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 8px;
}

:where(.history-tools) > .history-filter-row {
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
}

.history-actions-cell {
  vertical-align: middle;
}

.history-actions-trigger {
  width: 38px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.history-actions-trigger:hover,
.history-actions-trigger[aria-expanded="true"] {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary-active);
  box-shadow: 0 5px 16px rgba(9, 47, 99, 0.1);
}

.history-actions-trigger:focus-visible {
  outline: 3px solid rgba(24, 167, 181, 0.2);
  outline-offset: 2px;
}

.history-actions-dropdown {
  position: fixed;
  z-index: 1600;
  width: min(238px, calc(100vw - 24px));
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(9, 47, 99, 0.2);
}

.history-menu-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.history-menu-item:hover,
.history-menu-item:focus-visible {
  outline: none;
  background: var(--surface-subtle);
  color: var(--primary-active);
}

.history-menu-item-success {
  color: var(--success);
}

.history-menu-item-danger {
  margin-top: 3px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--danger);
}

.history-menu-item-danger:hover,
.history-menu-item-danger:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Dialogs and feedback */
.modal-backdrop,
.portal-dialog-backdrop {
  background: rgba(9, 47, 99, 0.62);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.modal-card,
.portal-dialog-card {
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.modal-header,
.portal-dialog-header,
.modal-body,
.portal-dialog-body {
  background: var(--surface);
}

.toast {
  border-color: rgba(121, 228, 240, 0.24);
  background: var(--ink-strong);
  box-shadow: 0 16px 38px rgba(4, 42, 87, 0.24);
}

.toast::before {
  border-color: var(--accent-cyan-soft);
}

/* Pointer and pressed feedback */
.primary-btn:active {
  border-color: var(--primary-active);
  background: var(--primary-active);
  box-shadow: inset 0 2px 4px rgba(4, 42, 87, 0.18);
}

.secondary-btn:active,
.password-toggle:active {
  background: var(--surface-muted);
  box-shadow: inset 0 1px 3px rgba(5, 60, 96, 0.12);
}

.soft-btn:active,
.compact-btn:active,
.voice-btn:active,
.voice-done-btn:active {
  border-color: var(--primary);
  background: rgba(12, 181, 203, 0.2);
  box-shadow: inset 0 1px 3px rgba(5, 60, 96, 0.1);
}

.success-btn:active {
  border-color: var(--success-hover);
  background: var(--success-hover);
}

.danger-btn:active {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger-hover);
}

.warning-btn:active {
  border-color: var(--warning-hover);
  background: var(--warning-hover);
}

.nav-btn:active,
.mobile-menu-btn:active,
.sidebar-user .secondary-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

@media (hover: hover) and (pointer: fine) {
  .nav-btn:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
  }

  .nav-btn.active:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.16);
  }

  .primary-btn:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(7, 83, 125, 0.18);
  }

  .secondary-btn:hover {
    border-color: var(--primary-line);
    background: var(--surface-subtle);
    color: var(--ink-strong);
  }

  .soft-btn:hover,
  .compact-btn:hover,
  .voice-btn:hover,
  .voice-done-btn:hover {
    border-color: var(--primary);
    background: var(--surface-subtle);
  }

  .password-toggle:hover {
    background: var(--surface-subtle);
    color: var(--primary-active);
  }

  .mobile-menu-btn:hover,
  .sidebar-user .secondary-btn:hover {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
  }

  .list-row:hover {
    border-color: var(--primary-line);
    background: var(--surface-subtle);
    box-shadow: var(--shadow-xs);
  }

  tbody tr:hover td {
    background: var(--surface-subtle);
  }
}

/* Responsive navigation and layouts */
@media (max-width: 1280px) {
  .main-content {
    padding: 24px;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 68px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 0 16px;
    padding: 12px 24px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(4, 42, 87, 0.12);
  }

  .sidebar::before {
    top: -190px;
    right: -70px;
  }

  .sidebar::after {
    display: none;
  }

  .sidebar-brand {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    padding: 0;
  }

  .mobile-menu-btn {
    grid-column: 2;
    grid-row: 1;
    display: grid;
  }

  .nav-section-label {
    display: none;
  }

  .side-nav {
    width: 100%;
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 14px 0 4px;
  }

  .nav-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .sidebar-user {
    grid-column: 1 / -1;
    grid-row: 3;
    display: none;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    margin: 8px 0 0;
  }

  .sidebar-user .secondary-btn {
    grid-column: auto;
    min-width: 92px;
  }

  .sidebar.mobile-nav-open .side-nav {
    display: grid;
  }

  .sidebar.mobile-nav-open .sidebar-user {
    display: grid;
  }

  .content-header {
    min-height: 78px;
    padding: 13px 24px;
  }

  .main-content {
    padding: 24px;
  }
}

@media (max-width: 900px) {
  .auth-screen {
    justify-items: center;
    padding: 24px;
  }

  .auth-layout {
    width: min(520px, 100%);
    min-height: 0;
    display: block;
  }

  .auth-story {
    display: none;
  }

  .login-card {
    min-height: min(680px, calc(100dvh - 48px));
    padding: 44px;
  }

  .login-brand {
    display: flex;
  }

  .patient-exercise-columns {
    grid-template-columns: 1fr;
  }

  .history-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-filter-row > button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .sidebar {
    min-height: 66px;
    padding: 11px 18px;
  }

  .content-header {
    min-height: 76px;
    padding: 12px 20px;
  }

  .content-header h1 {
    font-size: 1.35rem;
  }

  .main-content {
    gap: 18px;
    padding: 20px 18px;
  }

  .card,
  .management-panel,
  .ta-patient-section,
  .patient-workspace {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .card-header,
  .section-header,
  .panel-header {
    margin: -16px -16px 16px;
    padding: 14px 16px;
  }

  .patient-page-intro {
    padding: 12px 16px;
  }

  .history-filter-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .auth-screen {
    padding: 0;
  }

  .auth-layout {
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-card {
    min-height: 100dvh;
    padding: 32px 20px max(32px, env(safe-area-inset-bottom));
  }

  .login-brand {
    margin-bottom: 34px;
  }

  .login-card-header {
    margin-bottom: 26px;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .sidebar-user {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .sidebar-user .secondary-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .header-pill {
    max-width: min(48vw, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 520px) {
  .patient-page-intro {
    grid-template-columns: minmax(0, 1fr) 124px;
    gap: 10px;
    padding: 10px 12px;
  }

  .patient-exercise-date-toolbar,
  .current-exercise-history-toolbar,
  .patient-exercise-option {
    grid-template-columns: 1fr;
  }

  .patient-exercise-notice,
  .patient-exercise-save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .patient-exercise-notice > button,
  .patient-exercise-save-row > button {
    width: 100%;
  }

  .content-header {
    gap: 12px;
  }

  .content-header h1 {
    font-size: 1.25rem;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .modal-card,
  .portal-dialog-card {
    border-radius: 18px 18px 0 0;
    background: var(--surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  .recording-dot {
    animation: none !important;
  }

  .toast,
  .modal-card,
  .portal-dialog-card,
  .modal-backdrop,
  .portal-dialog-backdrop {
    transform: none !important;
  }
}


/* Provider notes */
.patient-provider-notes-panel {
  min-width: 0;
}

.provider-notes-intro {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.provider-notes-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.provider-note-list {
  display: grid;
  gap: 8px;
}

.provider-note-entry {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.provider-note-entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 6px;
}

.provider-note-entry-meta strong {
  color: var(--ink-strong);
  font-size: 0.8rem;
}

.provider-note-entry-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.provider-note-entry p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.overview-note-modal {
  width: min(980px, 100%);
}

.overview-note-modal-body {
  display: block;
  padding: 18px;
  background: var(--surface-subtle);
}

.overview-note-modal-body .ta-patient-section {
  margin: 0;
}

.provider-note-modal textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
}

@media (max-width: 640px) {
  .provider-notes-intro,
  .provider-note-entry-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-notes-heading-actions {
    justify-content: flex-start;
  }
}

/* Role-based permission policy cards */
.permissions-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, var(--primary-soft), transparent 44%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.permissions-hero h3 {
  margin: 2px 0 6px;
  color: var(--ink-strong);
  font-size: 1.18rem;
}

.permissions-hero p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.permissions-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
  flex: 0 0 auto;
}

.permissions-hero-stats span {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  text-align: center;
}

.permissions-hero-stats strong,
.permissions-hero-stats small {
  display: block;
}

.permissions-hero-stats strong {
  color: var(--ink-strong);
  font-size: 1rem;
  line-height: 1.1;
}

.permissions-hero-stats small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-permission-list {
  display: grid;
  gap: 12px;
}

.role-permission-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.role-permission-card[open] {
  border-color: var(--primary-line);
  box-shadow: var(--shadow-sm);
}

.role-permission-card > summary {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background-color var(--ease);
}

.role-permission-card > summary::-webkit-details-marker {
  display: none;
}

.role-permission-card[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.role-permission-card[open] > summary .accordion-chevron {
  transform: rotate(45deg);
}

.role-permission-identity,
.role-permission-meta {
  min-width: 0;
  display: flex;
  align-items: center;
}

.role-permission-identity {
  gap: 12px;
}

.role-permission-identity > span:last-child {
  min-width: 0;
}

.role-permission-identity strong,
.role-permission-identity small {
  display: block;
}

.role-permission-identity strong {
  color: var(--ink-strong);
  font-size: 0.92rem;
}

.role-permission-identity small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-permission-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--primary-line);
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.role-permission-avatar-admin {
  border-color: color-mix(in srgb, #8b5cf6 34%, var(--line));
  background: color-mix(in srgb, #8b5cf6 12%, var(--surface));
  color: #6d28d9;
}

.role-permission-avatar-provider {
  border-color: color-mix(in srgb, #0ea5e9 34%, var(--line));
  background: color-mix(in srgb, #0ea5e9 12%, var(--surface));
  color: #0369a1;
}

.role-permission-avatar-patient {
  border-color: color-mix(in srgb, #16a34a 32%, var(--line));
  background: color-mix(in srgb, #16a34a 11%, var(--surface));
  color: #15803d;
}

.role-permission-meta {
  flex: 0 0 auto;
  gap: 12px;
}

.role-permission-count {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.role-permission-body {
  padding: 14px;
  background: var(--surface-subtle);
}

.role-policy-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--primary-line);
  border-radius: 12px;
  background: var(--primary-soft);
}

.role-policy-notice-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  background-color: var(--primary-active);
  -webkit-mask-image: var(--icon-shield);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 17px;
  mask-image: var(--icon-shield);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 17px;
}

.role-policy-notice p,
.role-policy-notice strong,
.role-policy-notice small {
  display: block;
  margin: 0;
}

.role-policy-notice strong {
  color: var(--ink-strong);
  font-size: 0.76rem;
}

.role-policy-notice small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.69rem;
}

.role-permission-card .permission-groups {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.role-permission-card .permission-group {
  grid-template-columns: minmax(170px, 0.24fr) minmax(0, 1fr);
}

.role-permission-card .permission-group-heading {
  padding: 12px;
  background: var(--surface-subtle);
}

.role-permission-card .permission-group-heading strong,
.role-permission-card .permission-group-heading small {
  display: block;
}

.role-permission-card .permission-group-heading strong {
  font-size: 0.78rem;
}

.role-permission-card .permission-group-heading small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.35;
}

.role-permission-card .permission-check {
  min-height: 52px;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 10px;
}

.role-permission-card .permission-check input {
  position: relative;
  width: 36px;
  height: 20px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease);
}

.role-permission-card .permission-check input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform var(--ease);
}

.role-permission-card .permission-check input:checked {
  border-color: var(--primary-active);
  background: var(--primary-active);
}

.role-permission-card .permission-check input:checked::after {
  transform: translateX(16px);
}

.role-permission-card .permission-check input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.role-permission-card .permission-check strong {
  font-size: 0.72rem;
}

.role-permission-card .permission-check small {
  margin-top: 2px;
  font-size: 0.61rem;
  letter-spacing: 0.01em;
}

.role-permission-card .permission-check.page-permission {
  box-shadow: inset 3px 0 0 var(--primary-active);
}

.role-permission-card .permission-check.risk-permission:has(input:checked) {
  background: var(--danger-soft);
}

.role-permission-card .permission-safeguard {
  margin: 12px 0 0;
  border-radius: 10px;
}

@media (hover: hover) and (pointer: fine) {
  .role-permission-card > summary:hover {
    background: var(--surface-muted);
  }

  .role-permission-card:hover {
    border-color: var(--line-strong);
  }
}

@media (max-width: 900px) {
  .permissions-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .permissions-hero-stats {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .role-permission-card .permission-group {
    grid-template-columns: 1fr;
  }

  .role-permission-card .permission-group-heading {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 600px) {
  .permissions-hero {
    padding: 16px;
  }

  .permissions-hero-stats {
    grid-template-columns: 1fr;
  }

  .permissions-hero-stats span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .permissions-hero-stats small {
    margin-top: 0;
  }

  .role-permission-card > summary {
    align-items: flex-start;
    padding: 12px;
  }

  .role-permission-meta {
    gap: 7px;
  }

  .role-permission-count {
    display: none;
  }

  .role-permission-identity small {
    white-space: normal;
  }

  .role-permission-body {
    padding: 10px;
  }

  .role-permission-card .permission-check-list {
    grid-template-columns: 1fr;
  }
}


/* Patient Page bulk section controls */
.patient-page-intro {
  grid-template-columns: minmax(0, 1fr) auto;
}

.patient-page-intro .patient-page-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.patient-page-intro .patient-page-controls .form-field {
  flex: 0 0 136px;
  width: 136px;
}

.close-all-patient-sections-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .patient-page-intro {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .patient-page-intro .patient-page-controls {
    justify-content: stretch;
  }

  .close-all-patient-sections-btn {
    flex: 1 1 210px;
  }

  .patient-page-intro .patient-page-controls .form-field {
    flex: 1 0 124px;
    width: auto;
    max-width: 170px;
  }
}

@media (max-width: 440px) {
  .patient-page-intro .patient-page-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .close-all-patient-sections-btn,
  .patient-page-intro .patient-page-controls .form-field {
    width: 100%;
    max-width: none;
  }
}

/* MM/DD/YYYY date filters with restored calendar picker control */
.display-date-picker {
  position: relative;
  min-width: 0;
}

.display-date-picker > input[type="text"] {
  width: 100%;
  padding-right: 48px;
}

.display-date-picker-button {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-subtle);
  pointer-events: none;
  transform: translateY(-50%);
  transition: background-color var(--ease), box-shadow var(--ease);
}

.display-date-picker-button::before {
  content: "";
  position: absolute;
  inset: 8px;
  background-color: var(--primary);
  -webkit-mask-image: var(--icon-calendar);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: var(--icon-calendar);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.display-date-picker-native {
  position: absolute;
  top: 50%;
  right: 7px;
  z-index: 1;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  transform: translateY(-50%);
}

.display-date-picker:hover .display-date-picker-button,
.display-date-picker:focus-within .display-date-picker-button {
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(7, 83, 125, 0.12);
}

/* Patient treatment filtering and manual exercise times */
.patient-treatment-filter {
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.patient-treatment-filter label {
  font-size: 0.72rem;
}

.patient-treatment-filter select {
  width: 100%;
}

.patient-exercise-duration-controls {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.patient-exercise-manual-duration {
  width: 100%;
}

.patient-exercise-manual-duration[hidden] {
  display: none;
}

@media (min-width: 1180px) {
  .patient-exercise-option {
    grid-template-columns: minmax(125px, 0.34fr) minmax(0, 1fr);
  }
}

/* Keep the Assign Exercises list compact by showing about ten rows at once. */
.available-exercises-panel .patient-exercise-option-list {
  max-height: 526px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

@media (max-width: 520px) {
  .available-exercises-panel .patient-exercise-option-list {
    max-height: 720px;
  }
}

/* Access Control account directory */
.access-tab-icon-accounts {
  -webkit-mask-image: var(--icon-users);
  mask-image: var(--icon-users);
}

.accounts-management-layout {
  display: grid;
  gap: 18px;
}

.accounts-management-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, var(--primary-soft), transparent 44%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.accounts-management-hero h3 {
  margin: 2px 0 6px;
  color: var(--ink-strong);
  font-size: 1.18rem;
}

.accounts-management-hero p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.accounts-management-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
  flex: 0 0 auto;
}

.accounts-management-stats span {
  min-width: 82px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  text-align: center;
}

.accounts-management-stats strong,
.accounts-management-stats small {
  display: block;
}

.accounts-management-stats strong {
  color: var(--ink-strong);
  font-size: 1rem;
  line-height: 1.1;
}

.accounts-management-stats small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.accounts-management-table-wrap {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.accounts-management-table {
  min-width: 820px;
}

.accounts-management-table th:last-child,
.accounts-management-table td:last-child {
  width: 76px;
  text-align: center;
}

.accounts-management-table tbody tr:hover {
  background: var(--surface-subtle);
}

.account-identity-cell,
.account-modal-summary {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.account-identity-cell > span:last-child,
.account-modal-summary > span:last-child {
  min-width: 0;
}

.account-identity-cell strong,
.account-identity-cell small,
.account-modal-summary strong,
.account-modal-summary small {
  display: block;
}

.account-identity-cell strong {
  overflow: hidden;
  color: var(--ink-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity-cell small,
.account-modal-summary small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.account-role-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--primary-line);
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.account-role-avatar-admin {
  border-color: color-mix(in srgb, #8b5cf6 34%, var(--line));
  background: color-mix(in srgb, #8b5cf6 12%, var(--surface));
  color: #6d28d9;
}

.account-role-avatar-provider {
  border-color: color-mix(in srgb, #0ea5e9 34%, var(--line));
  background: color-mix(in srgb, #0ea5e9 12%, var(--surface));
  color: #0369a1;
}

.account-role-avatar-patient {
  border-color: color-mix(in srgb, #16a34a 32%, var(--line));
  background: color-mix(in srgb, #16a34a 11%, var(--surface));
  color: #15803d;
}

.account-username {
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
}

.account-actions-cell {
  position: relative;
  overflow: visible;
}

.account-actions-menu {
  position: relative;
  display: inline-block;
}

.account-actions-menu > summary {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}

.account-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.account-actions-menu[open] > summary,
.account-actions-menu > summary:hover {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary-active);
}

.account-actions-dropdown {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 190px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.account-actions-dropdown button {
  width: 100%;
  min-height: 38px;
  display: block;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
}

.account-actions-dropdown button:hover,
.account-actions-dropdown button:focus-visible {
  background: var(--surface-muted);
  color: var(--ink-strong);
}

.account-actions-dropdown .danger-menu-action {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--danger);
}

.account-actions-dropdown .danger-menu-action:hover,
.account-actions-dropdown .danger-menu-action:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}

.account-no-actions {
  font-size: 0.68rem;
  white-space: nowrap;
}

.account-management-modal .modal-body {
  display: grid;
  gap: 14px;
}

.account-modal-summary {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
}

@media (max-width: 900px) {
  .accounts-management-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .accounts-management-stats {
    width: 100%;
  }

  .accounts-management-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
  }
}

@media (max-width: 600px) {
  .accounts-management-hero {
    padding: 16px;
  }

  .accounts-management-stats {
    grid-template-columns: 1fr;
  }

  .accounts-management-stats span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .accounts-management-stats small {
    margin-top: 0;
  }
}

/* Exercise sequencing for assigned daily plans */
.patient-exercise-option {
  grid-template-columns: 54px minmax(112px, 0.32fr) minmax(0, 1fr);
}

.patient-exercise-sequence-field {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.patient-exercise-sequence-prefix {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.patient-exercise-sequence-field input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 5px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.patient-exercise-sequence-field input:disabled {
  opacity: 0.52;
}

.current-exercise-item {
  grid-template-columns: 32px minmax(88px, auto) minmax(0, 1fr);
}

.current-exercise-sequence {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-line);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.72rem;
  font-weight: 800;
}

@media (min-width: 1180px) {
  .patient-exercise-option {
    grid-template-columns: 58px minmax(125px, 0.34fr) minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .patient-exercise-option {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .patient-exercise-choice {
    grid-column: 1 / -1;
  }

  .current-exercise-item {
    grid-template-columns: 30px minmax(82px, auto) minmax(0, 1fr);
    gap: 7px;
  }
}

/* Embedded exercise library */
#mainContent[data-view="exercises"] {
  width: 100%;
  max-width: none;
  min-height: calc(100dvh - 80px);
  display: block;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.exercise-library-frame-shell {
  width: 100%;
  min-height: calc(100dvh - 80px);
  background: #ffffff;
}

.exercise-library-frame {
  width: 100%;
  height: calc(100dvh - 80px);
  min-height: 680px;
  display: block;
  border: 0;
  background: #ffffff;
}

@media (max-width: 1024px) {
  #mainContent[data-view="exercises"],
  .exercise-library-frame-shell {
    min-height: calc(100dvh - 146px);
  }

  .exercise-library-frame {
    height: calc(100dvh - 146px);
    min-height: 620px;
  }
}

@media (max-width: 768px) {
  #mainContent[data-view="exercises"],
  .exercise-library-frame-shell {
    min-height: calc(100dvh - 142px);
  }

  .exercise-library-frame {
    height: calc(100dvh - 142px);
    min-height: 560px;
  }
}


/* ========================================================================== 
   Notes Form — Blue Glass + Neumorphic Visual System
   Visual-only layer. Existing application behavior and DOM hooks are retained.
   ========================================================================== */
:root {
  --canvas: #eaf4ff;
  --canvas-strong: #d7eaff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-subtle: rgba(242, 248, 255, 0.84);
  --surface-muted: rgba(224, 238, 252, 0.82);
  --ink: #17375f;
  --ink-strong: #08285f;
  --ink-soft: #315d8e;
  --muted: #597797;
  --muted-light: #6e89a5;
  --line: rgba(31, 104, 177, 0.14);
  --line-strong: rgba(25, 91, 158, 0.24);
  --nav: #0b326b;
  --nav-elevated: rgba(223, 238, 255, 0.74);
  --nav-text: #17375f;
  --nav-muted: #6684a5;
  --primary: #1e6fc2;
  --primary-hover: #175da6;
  --primary-active: #114d8d;
  --primary-soft: rgba(56, 139, 216, 0.13);
  --primary-line: rgba(35, 116, 193, 0.28);
  --focus: #155fa8;
  --accent-cyan: #55b4ea;
  --accent-cyan-soft: #b9e4fb;
  --nav-gradient: linear-gradient(160deg, rgba(255,255,255,.9), rgba(235,245,255,.78));
  --shadow-xs: 0 3px 10px rgba(56, 101, 148, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-sm: 10px 12px 28px rgba(60, 103, 145, 0.10), -8px -8px 22px rgba(255, 255, 255, 0.82), inset 0 1px 0 rgba(255,255,255,.82);
  --shadow-md: 15px 18px 42px rgba(50, 91, 134, 0.13), -10px -10px 28px rgba(255, 255, 255, 0.78), inset 0 1px 0 rgba(255,255,255,.86);
  --shadow-lg: 24px 30px 70px rgba(42, 80, 124, 0.18), -15px -15px 40px rgba(255,255,255,.78), inset 0 1px 0 rgba(255,255,255,.9);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 26px;
}

html,
body {
  background:
    radial-gradient(circle at 84% 10%, rgba(118, 192, 239, 0.28), transparent 28rem),
    radial-gradient(circle at 8% 92%, rgba(82, 159, 219, 0.18), transparent 30rem),
    linear-gradient(145deg, #f5faff 0%, #eaf4ff 48%, #dceeff 100%);
}

body {
  color: var(--ink);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
}

body::before {
  right: -13rem;
  top: 12%;
  width: 34rem;
  height: 34rem;
  border: 1px solid rgba(88, 164, 222, 0.2);
  box-shadow: 0 0 0 5rem rgba(120, 192, 239, 0.035), 0 0 0 10rem rgba(120, 192, 239, 0.025);
}

body::after {
  left: -18rem;
  bottom: -19rem;
  width: 42rem;
  height: 42rem;
  background: radial-gradient(circle, rgba(95, 176, 231, 0.12), transparent 67%);
}

/* Authentication */
.auth-screen {
  position: relative;
  z-index: 1;
  padding: clamp(22px, 4vw, 58px);
  background: transparent;
}

.auth-layout {
  position: relative;
  width: min(1120px, 100%);
  min-height: 680px;
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(420px, 0.92fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-layout::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  min-height: 650px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 34px;
  background:
    radial-gradient(circle at 26% 27%, rgba(255,255,255,.9) 0 4px, transparent 5px),
    radial-gradient(circle at 73% 70%, rgba(255,255,255,.76) 0 8px, transparent 9px),
    radial-gradient(circle at 50% 42%, rgba(116, 190, 237, 0.22), transparent 16rem),
    linear-gradient(145deg, rgba(255,255,255,.58), rgba(206,230,250,.36));
  background-size: 34px 34px, auto, auto, auto;
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(24px) saturate(1.1);
  backdrop-filter: blur(24px) saturate(1.1);
}

.auth-layout::after {
  content: "";
  position: absolute;
  left: clamp(65px, 9vw, 130px);
  top: 50%;
  width: clamp(250px, 29vw, 390px);
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 32% 68% 64% 36% / 36% 34% 66% 64%;
  background:
    linear-gradient(145deg, rgba(255,255,255,.62), rgba(174,216,246,.27)),
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.88), transparent 34%);
  box-shadow: 18px 22px 44px rgba(58,101,145,.12), inset 0 1px 0 rgba(255,255,255,.92);
  transform: translateY(-50%) rotate(-8deg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.login-card {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  padding: clamp(34px, 4vw, 50px);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(25px) saturate(1.12);
  backdrop-filter: blur(25px) saturate(1.12);
}

.login-brand {
  justify-content: center;
  margin-bottom: 30px;
}

.login-brand .brand-icon,
.sidebar-brand .brand-icon {
  border: 1px solid rgba(255,255,255,.72);
  background: linear-gradient(145deg, #2b83d2, #12579e);
  color: #fff;
  box-shadow: 7px 8px 18px rgba(30, 93, 154, 0.22), -5px -5px 14px rgba(255,255,255,.8), inset 0 1px 0 rgba(255,255,255,.5);
}

.login-brand strong {
  color: var(--ink-strong);
  font-size: 1.22rem;
}

.login-card-header {
  text-align: center;
}

.login-card-header h2 {
  color: var(--ink-strong);
  font-size: clamp(1.7rem, 3vw, 2.15rem);
}

.login-card-header p,
.login-help small {
  color: var(--muted);
}

.login-form {
  gap: 18px;
}

.login-card input,
.password-control {
  border-radius: 14px;
}

.login-help {
  border-color: var(--line);
  border-radius: 16px;
  background: rgba(232, 243, 254, 0.72);
  box-shadow: inset 3px 3px 9px rgba(67,112,156,.07), inset -3px -3px 9px rgba(255,255,255,.9);
}

/* Main shell */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: transparent;
}

.sidebar {
  top: 14px;
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  gap: 10px;
  padding: 24px 16px 18px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 26px;
  background: var(--nav-gradient);
  color: var(--nav-text);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(25px) saturate(1.12);
  backdrop-filter: blur(25px) saturate(1.12);
}

.sidebar::before {
  top: auto;
  right: -80px;
  bottom: 12%;
  width: 230px;
  height: 230px;
  border-color: rgba(72, 146, 211, 0.14);
  background: radial-gradient(circle, rgba(64, 144, 213, 0.09), transparent 66%);
  background-size: auto;
  box-shadow: 0 0 0 52px rgba(70,150,218,.025);
}

.sidebar::after {
  left: -110px;
  bottom: -165px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(57, 132, 200, 0.13);
  border-radius: 50%;
  transform: none;
  box-shadow: 0 0 0 48px rgba(72,154,219,.025);
}

.sidebar-brand {
  min-height: 52px;
  margin-bottom: 14px;
  padding: 0 8px;
}

.sidebar-brand strong {
  color: var(--ink-strong);
  font-size: 1.08rem;
}

.sidebar-brand small {
  color: var(--muted);
}

.nav-section-label {
  color: var(--primary);
  font-size: .68rem;
  letter-spacing: .14em;
}

.nav-btn {
  min-height: 48px;
  border-radius: 14px;
  color: var(--ink-soft);
  font-weight: 650;
}

.nav-btn.active {
  border-color: rgba(63, 144, 215, 0.22);
  background: linear-gradient(145deg, rgba(224,241,255,.94), rgba(245,250,255,.82));
  color: var(--primary-active);
  box-shadow: 7px 8px 18px rgba(72,113,154,.11), -5px -5px 14px rgba(255,255,255,.88), inset 3px 0 0 #4b9ddb;
}

:where(.sidebar button, .sidebar a):focus-visible {
  outline-color: var(--primary);
}

.sidebar-user {
  border-color: rgba(50, 123, 191, 0.15);
  border-radius: 18px;
  background: rgba(226, 240, 253, 0.74);
  box-shadow: inset 4px 4px 11px rgba(71,112,151,.07), inset -4px -4px 11px rgba(255,255,255,.9);
}

.sidebar-user::before {
  border-color: rgba(45, 119, 188, .17);
  background-color: var(--primary);
}

.sidebar-user strong {
  color: var(--ink-strong);
}

.sidebar-user small {
  color: var(--muted);
}

.sidebar-user .secondary-btn {
  border-color: rgba(40,110,178,.17);
  background: rgba(255,255,255,.62);
  color: var(--primary-active);
  box-shadow: 4px 5px 12px rgba(65,105,145,.07), -3px -3px 9px rgba(255,255,255,.82);
}

.sidebar-collapse-btn {
  border-color: rgba(39, 111, 180, 0.16);
  background: rgba(255,255,255,.58);
  color: var(--primary-active);
  box-shadow: var(--shadow-xs);
}

.content-area {
  min-width: 0;
  min-height: calc(100dvh - 28px);
  overflow: clip;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 26px;
  background: rgba(246, 251, 255, 0.58);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
  backdrop-filter: blur(24px) saturate(1.08);
}

.content-header {
  top: 0;
  min-height: 92px;
  margin: 0;
  padding: 18px clamp(24px, 3vw, 38px);
  border: 0;
  border-bottom: 1px solid rgba(38, 108, 177, 0.12);
  border-radius: 26px 26px 0 0;
  background: rgba(255,255,255,.64);
  box-shadow: 0 8px 22px rgba(54, 100, 145, 0.06);
  -webkit-backdrop-filter: blur(23px) saturate(1.08);
  backdrop-filter: blur(23px) saturate(1.08);
}

.content-header .eyebrow {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: .7rem;
}

.content-header h1 {
  color: var(--ink-strong);
  font-size: clamp(1.75rem, 2.6vw, 2.2rem);
  font-weight: 730;
}

.header-pill {
  min-height: 42px;
  padding: 9px 15px;
  border-color: rgba(38,111,181,.17);
  border-radius: 14px;
  background: rgba(239,247,255,.78);
  color: var(--ink-soft);
  box-shadow: 6px 7px 16px rgba(68,108,148,.08), -4px -4px 12px rgba(255,255,255,.9), inset 0 1px 0 rgba(255,255,255,.85);
}

.header-pill::before {
  background-color: var(--primary);
}

.main-content {
  width: 100%;
  max-width: none;
  gap: 22px;
  padding: clamp(20px, 2.6vw, 34px);
}

#mainContent[data-view="overview"] {
  grid-template-columns: minmax(0, 1fr);
}

#mainContent[data-view="overview"] > * {
  grid-column: 1 / -1;
}

/* Glass panels and restrained neumorphic depth */
.card,
.management-panel,
.ta-patient-section,
.patient-workspace,
.staff-assignment-card,
.patient-assignment,
.page-intro-card,
.permissions-hero,
.accounts-management-hero,
.patient-list-pane,
.patient-detail-pane,
.access-summary,
.registration-guidance,
.access-category,
.role-permission-card,
.audit-placeholder {
  border-color: rgba(33, 105, 174, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px) saturate(1.06);
  backdrop-filter: blur(18px) saturate(1.06);
}

.card,
.management-panel,
.ta-patient-section,
.patient-workspace {
  padding: 22px;
}

.card-header,
.section-header,
.panel-header {
  margin: -22px -22px 20px;
  padding: 17px 22px;
  border-color: rgba(40, 110, 177, 0.12);
  background: linear-gradient(145deg, rgba(242,248,255,.78), rgba(255,255,255,.45));
}

.card-header h2,
.card-header h3,
.section-header h2,
.section-header h3,
.panel-header h2,
.panel-header h3 {
  color: var(--ink-strong);
  font-size: 1.04rem;
}

.page-intro-card,
.patient-page-intro,
.assignment-page-intro,
.access-control-intro,
.patient-panel-intro {
  border-color: rgba(36, 112, 184, 0.17);
  background:
    radial-gradient(circle at 92% 12%, rgba(104,183,235,.18), transparent 13rem),
    rgba(255,255,255,.68);
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  min-height: 126px;
  padding: 20px;
  border-color: rgba(35, 106, 176, 0.14);
  border-radius: 20px;
  background: rgba(255,255,255,.74);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.metric-card::before {
  opacity: .78;
}

.metric-card:has(.metric-icon) .metric-icon,
.metric-card .metric-icon {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  border: 1px solid rgba(55,137,211,.18);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(234,246,255,.96), rgba(205,230,250,.72));
  color: var(--primary);
  box-shadow: 6px 7px 16px rgba(71,111,151,.1), -4px -4px 12px rgba(255,255,255,.9), inset 0 1px 0 rgba(255,255,255,.9);
}

.metric-card p {
  color: var(--ink-soft);
  font-weight: 650;
}

.metric-card strong {
  color: var(--ink-strong);
  font-size: 1.85rem;
}

.metric-card small {
  color: var(--muted);
}

/* Forms and buttons */
input,
select,
textarea,
.password-control,
.search-inline,
.patient-search-field,
.display-date-picker-button {
  border-color: rgba(35, 106, 176, 0.17);
  border-radius: 13px;
  background: rgba(255,255,255,.73);
  box-shadow: inset 3px 3px 9px rgba(63,106,148,.06), inset -3px -3px 9px rgba(255,255,255,.88);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,.9);
  box-shadow: 0 0 0 4px rgba(30,111,194,.12), inset 2px 2px 7px rgba(63,106,148,.04);
}

.primary-btn,
.success-btn {
  min-height: 42px;
  border-color: #1c6abd;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f84d1, #145aa4);
  color: #fff;
  box-shadow: 7px 9px 18px rgba(26, 87, 146, .19), -4px -4px 12px rgba(255,255,255,.6), inset 0 1px 0 rgba(255,255,255,.28);
}

.secondary-btn,
.soft-btn,
.compact-btn,
.voice-btn,
.voice-done-btn,
.history-actions-trigger,
.account-actions-menu > summary {
  border-color: rgba(33,105,174,.18);
  border-radius: 11px;
  background: rgba(247,251,255,.74);
  color: var(--primary-active);
  box-shadow: 5px 6px 14px rgba(64,105,145,.08), -3px -3px 9px rgba(255,255,255,.88), inset 0 1px 0 rgba(255,255,255,.85);
}

.badge {
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.badge.soft {
  border-color: rgba(49, 131, 205, 0.16);
  background: rgba(218,238,255,.8);
  color: #185b9e;
}

/* Tables, rows and nested content */
.table-wrap,
.history-table-wrap,
.list-row,
.note-card,
.exercise-row,
.readonly-note,
.readonly-detail-block,
.staff-assignment-header,
.assignment-toolbar,
.assigned-patient-row,
.note-input-block,
.checkbox-card,
.modal-checkbox-card,
.patient-exercise-panel,
.patient-exercise-option,
.current-exercise-meta,
.current-exercise-item,
.patient-exercise-schedule,
.provider-note-entry,
.patient-note-row,
.history-view-note-row,
.access-record,
.patient-rail-item {
  border-color: rgba(34, 105, 175, 0.13);
  border-radius: 15px;
  background: rgba(255,255,255,.63);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82);
}

.table-wrap,
.history-table-wrap {
  overflow: auto;
  border: 1px solid rgba(34, 105, 175, 0.13);
  border-radius: 17px;
  background: rgba(255,255,255,.53);
  box-shadow: inset 3px 3px 10px rgba(70,110,150,.045), inset -3px -3px 10px rgba(255,255,255,.75);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: rgba(224, 239, 253, 0.72);
  color: var(--ink-soft);
  font-weight: 750;
}

td {
  background: rgba(255,255,255,.38);
}

tbody tr:hover td {
  background: rgba(224,239,253,.52);
}

.empty-state,
.compact-empty-state {
  border-color: rgba(39, 113, 183, 0.22);
  border-radius: 16px;
  background: rgba(224, 240, 254, 0.62);
  color: var(--muted);
}

.workspace-tabs,
.access-tabs {
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(34,105,175,.13);
  border-radius: 16px;
  background: rgba(232,243,253,.66);
  box-shadow: inset 3px 3px 9px rgba(67,108,148,.05), inset -3px -3px 9px rgba(255,255,255,.82);
}

.workspace-tab {
  border-radius: 11px;
}

.workspace-tab.active,
.access-tabs .active {
  background: rgba(255,255,255,.86);
  color: var(--primary-active);
  box-shadow: 5px 6px 13px rgba(62,103,144,.08), -3px -3px 9px rgba(255,255,255,.8);
}

.patient-rail-item.selected,
.patient-exercise-option.selected {
  border-color: rgba(34, 113, 189, 0.28);
  background: rgba(225,241,255,.75);
  box-shadow: inset 3px 0 0 #3e8fd4, 5px 7px 15px rgba(62,103,144,.07);
}

.row-avatar,
.staff-assignment-avatar,
.assigned-patient-number,
.exercise-number,
.patient-detail-avatar,
.account-role-avatar,
.role-permission-avatar {
  border-color: rgba(38, 120, 196, 0.18);
  background: linear-gradient(145deg, rgba(235,247,255,.94), rgba(202,229,250,.72));
  color: var(--primary-active);
  box-shadow: 4px 5px 12px rgba(67,108,148,.08), -3px -3px 8px rgba(255,255,255,.85);
}

/* Access Control */
.access-control-shell,
.permissions-layout,
.accounts-management-layout,
.registration-layout {
  gap: 20px;
}

.access-category-list,
.permission-groups,
.role-permission-list {
  gap: 14px;
}

.permission-check,
.registration-checkbox {
  border-radius: 12px;
  background: rgba(244,249,255,.62);
}

/* Assignment and patient workspace */
.staff-assignment-card.open {
  border-color: rgba(36, 116, 192, 0.25);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(35,116,193,.04);
}

.staff-assignment-body,
.modal-actions,
.portal-dialog-actions {
  border-color: rgba(38, 108, 177, 0.12);
  background: rgba(230,242,253,.62);
}

/* Dialogs */
.modal-backdrop,
.portal-dialog-backdrop {
  background: rgba(6, 37, 78, 0.46);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.modal-card,
.portal-dialog-card {
  border-color: rgba(255,255,255,.82);
  border-radius: 24px;
  background: rgba(250,253,255,.86);
  box-shadow: 0 28px 75px rgba(9,43,84,.25), inset 0 1px 0 rgba(255,255,255,.9);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.modal-header,
.portal-dialog-header,
.modal-body,
.portal-dialog-body {
  background: transparent;
}

.history-actions-dropdown,
.account-actions-dropdown {
  border-color: rgba(35,106,176,.16);
  border-radius: 15px;
  background: rgba(250,253,255,.92);
  box-shadow: 0 18px 45px rgba(20,65,111,.18);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* Exercises library host */
#mainContent[data-view="exercises"] {
  min-height: calc(100dvh - 120px);
  padding: clamp(16px, 2.2vw, 26px);
  background: transparent;
}

.exercise-library-frame-shell {
  min-height: calc(100dvh - 146px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 22px;
  background: rgba(255,255,255,.58);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.exercise-library-frame {
  height: calc(100dvh - 146px);
  min-height: min(650px, calc(100dvh - 16px));
  background: transparent;
}

/* Hover states */
@media (hover: hover) and (pointer: fine) {
  .nav-btn:hover {
    border-color: rgba(53, 132, 205, 0.13);
    background: rgba(222,238,252,.55);
    color: var(--primary-active);
  }

  .nav-btn.active:hover {
    border-color: rgba(63,144,215,.26);
    background: linear-gradient(145deg, rgba(218,238,255,.96), rgba(249,252,255,.86));
  }

  .primary-btn:hover,
  .success-btn:hover {
    border-color: #15599e;
    background: linear-gradient(135deg, #2678c4, #104e91);
    box-shadow: 9px 11px 22px rgba(25,82,139,.22), -4px -4px 12px rgba(255,255,255,.62);
  }

  .secondary-btn:hover,
  .soft-btn:hover,
  .compact-btn:hover,
  .voice-btn:hover,
  .voice-done-btn:hover {
    border-color: rgba(31, 112, 190, .3);
    background: rgba(225,241,255,.78);
    color: var(--primary-active);
  }

  .metric-card:hover,
  .card:hover {
    border-color: rgba(42, 123, 198, 0.2);
  }
}

/* Responsive visual continuity */
@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .app-shell {
    display: block;
    padding: 10px;
  }

  .sidebar {
    top: 10px;
    width: calc(100% - 20px);
    height: auto;
    min-height: 70px;
    margin: 0 10px 10px;
    border-radius: 20px;
  }

  .content-area {
    min-height: calc(100dvh - 100px);
    border-radius: 22px;
  }

  .content-header {
    border-radius: 22px 22px 0 0;
  }

  #mainContent[data-view="exercises"],
  .exercise-library-frame-shell {
    min-height: calc(100dvh - 180px);
  }

  .exercise-library-frame {
    height: calc(100dvh - 180px);
  }
}

@media (max-width: 760px) {
  body::before,
  body::after {
    display: none;
  }

  .auth-layout {
    min-height: 0;
    display: block;
  }

  .auth-layout::before,
  .auth-layout::after {
    display: none;
  }

  .login-card {
    width: min(540px, 100%);
    margin: 0 auto;
    padding: 28px 22px;
    border-radius: 24px;
  }

  .app-shell {
    padding: 0;
  }

  .sidebar {
    top: 0;
    width: 100%;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .content-area {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .content-header {
    min-height: 76px;
    padding: 14px 16px;
    border-radius: 0;
  }

  .main-content {
    padding: 16px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 106px;
  }

  #mainContent[data-view="exercises"] {
    padding: 10px;
  }

  .exercise-library-frame-shell {
    border-radius: 16px;
  }
}

/* Sidebar color update — reference-matched deep navy and blue palette */
.sidebar {
  border-color: rgba(74, 132, 203, 0.24);
  background:
    radial-gradient(circle at 16% 72%, rgba(0, 117, 209, 0.42), transparent 38%),
    linear-gradient(180deg, #080b58 0%, #0a1d59 38%, #0758a6 72%, #061f55 100%);
  color: #eef6ff;
  box-shadow: 0 18px 42px rgba(3, 20, 65, 0.3);
}

.sidebar::before {
  border-color: rgba(77, 165, 235, 0.16);
  background: radial-gradient(circle, rgba(24, 135, 220, 0.16), transparent 68%);
  box-shadow: 0 0 0 52px rgba(18, 112, 195, 0.035);
}

.sidebar::after {
  border-color: rgba(74, 155, 225, 0.14);
  box-shadow: 0 0 0 48px rgba(24, 118, 201, 0.035);
}

.sidebar-brand strong,
.sidebar-user strong {
  color: #ffffff;
}

.sidebar-brand small,
.sidebar-user small {
  color: #b8c9e6;
}

.nav-section-label {
  color: #8eb9e8;
}

.nav-btn {
  color: #d3e1f5;
}

.nav-btn::before {
  opacity: 0.88;
}

.nav-btn.active {
  border-color: rgba(108, 202, 255, 0.38);
  background: linear-gradient(135deg, rgba(8, 104, 184, 0.96), rgba(10, 132, 201, 0.88));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #7edaff, 0 8px 20px rgba(0, 25, 77, 0.28);
}

.sidebar-user {
  border-color: rgba(123, 187, 239, 0.24);
  background: rgba(3, 27, 78, 0.46);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.08), inset -1px -1px 0 rgba(0,0,0,.12);
}

.sidebar-user::before {
  border-color: rgba(143, 211, 255, 0.34);
  background-color: #43b8f0;
}

.sidebar-user .secondary-btn,
.sidebar-collapse-btn {
  border-color: rgba(129, 192, 239, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #eef7ff;
  box-shadow: none;
}

:where(.sidebar button, .sidebar a):focus-visible {
  outline-color: #7edaff;
}

@media (hover: hover) {
  .nav-btn:hover {
    background: rgba(44, 125, 195, 0.24);
    color: #ffffff;
  }

  .nav-btn.active:hover {
    background: linear-gradient(135deg, rgba(8, 104, 184, 1), rgba(10, 132, 201, 0.96));
    color: #ffffff;
  }

  .sidebar-user .secondary-btn:hover,
  .sidebar-collapse-btn:hover {
    border-color: rgba(142, 211, 255, 0.42);
    background: rgba(73, 163, 226, 0.2);
    color: #ffffff;
  }
}


/* Reference blue coverage, icon clarity, and brand cleanup — 2026-08-06 */
:root {
  --reference-navy: #080b58;
  --reference-navy-deep: #061f55;
  --reference-blue: #0758a6;
  --reference-blue-bright: #087fc1;
  --reference-light-blue: #d9f3fb;
  --reference-light-blue-strong: #c7e8f7;
  --canvas: #d9f3fb;
  --canvas-strong: #c7e8f7;
  --surface: #f8fcff;
  --surface-subtle: #e4f4fb;
  --surface-muted: #d3eaf6;
  --ink: #102f5c;
  --ink-strong: #080b58;
  --ink-soft: #244f7d;
  --muted: #4c6f91;
  --muted-light: #6683a0;
  --line: rgba(7, 88, 166, 0.18);
  --line-strong: rgba(7, 88, 166, 0.31);
  --primary: #0758a6;
  --primary-hover: #06478b;
  --primary-active: #061f55;
  --primary-soft: rgba(7, 88, 166, 0.13);
  --primary-line: rgba(7, 88, 166, 0.31);
  --focus: #087fc1;
  --accent-cyan: #087fc1;
  --accent-cyan-soft: #8ddcff;
  --icon-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4.5 21a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E");
  --icon-clipboard-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='17' rx='2'/%3E%3Cpath d='M9 4.5V3h6v1.5M9 9h6'/%3E%3Ccircle cx='10' cy='14' r='2'/%3E%3Cpath d='M7.5 19a2.5 2.5 0 0 1 5 0M15 14h2.5M15 17h2.5'/%3E%3C/svg%3E");
  --icon-dumbbell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9v6M3.5 10v4M18 9v6M20.5 10v4M6 12h12'/%3E%3C/svg%3E");
  --icon-globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a15 15 0 0 1 0 18M12 3a15 15 0 0 0 0 18'/%3E%3C/svg%3E");
  --icon-list-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 7 1.5 1.5L8 6M11 7h9M4 12l1.5 1.5L8 11M11 12h9M4 17l1.5 1.5L8 16M11 17h9'/%3E%3C/svg%3E");
}

html,
body,
.app-shell,
.content-area {
  background:
    radial-gradient(circle at 88% 8%, rgba(8, 127, 193, 0.18), transparent 27rem),
    radial-gradient(circle at 7% 92%, rgba(7, 88, 166, 0.12), transparent 30rem),
    linear-gradient(145deg, #e8f8fd 0%, var(--reference-light-blue) 48%, #cdebf7 100%);
  background-attachment: fixed;
}

/* The reference palette now occupies the header, canvas, cards, tables, controls, and actions. */
.content-header {
  border-bottom-color: rgba(141, 220, 255, 0.28);
  background:
    radial-gradient(circle at 82% 20%, rgba(8, 127, 193, 0.42), transparent 19rem),
    linear-gradient(115deg, var(--reference-navy) 0%, #0a1d59 48%, var(--reference-blue) 100%);
  color: #f4f9ff;
}

.content-header .eyebrow,
.content-header h1 {
  color: #ffffff;
}

.content-header .eyebrow {
  opacity: 0.72;
}

.header-pill {
  border-color: rgba(141, 220, 255, 0.34);
  background: rgba(4, 31, 85, 0.38);
  color: #eff8ff;
}

.header-pill::before {
  background-color: #8ddcff;
}

.main-content {
  background:
    linear-gradient(180deg, rgba(218, 242, 251, 0.82), rgba(201, 232, 246, 0.76));
}

.card,
.management-panel,
.ta-patient-section,
.patient-workspace,
.staff-assignment-card,
.patient-assignment,
.patient-list-pane,
.patient-detail-pane,
.access-control-shell,
.access-tab-panel,
.role-permission-card,
.exercise-library-frame-shell {
  border-color: rgba(7, 88, 166, 0.21);
  background: linear-gradient(145deg, rgba(248, 252, 255, 0.95), rgba(222, 241, 250, 0.91));
}

.metric-card,
.page-intro-card,
.patient-page-intro,
.patient-welcome,
.patient-session-header,
.access-control-intro,
.patient-panel-intro,
.assignment-toolbar,
.history-tools {
  border-color: rgba(7, 88, 166, 0.23);
  background:
    linear-gradient(145deg, rgba(232, 247, 253, 0.97), rgba(198, 231, 246, 0.9));
}

.card-header,
.section-header,
.panel-header,
.patient-list-pane-header,
.patient-detail-header,
.access-section-heading,
.staff-assignment-header {
  border-color: rgba(7, 88, 166, 0.22);
  background: linear-gradient(135deg, rgba(201, 233, 247, 0.96), rgba(230, 246, 253, 0.94));
}

.table-wrap,
.history-table-wrap,
.list-row,
.note-card,
.exercise-row,
.readonly-note,
.readonly-detail-block,
.assigned-patient-row,
.note-input-block,
.checkbox-card,
.modal-checkbox-card,
.patient-exercise-panel,
.patient-exercise-option,
.current-exercise-meta,
.current-exercise-item,
.patient-exercise-schedule,
.access-category,
.access-record {
  border-color: rgba(7, 88, 166, 0.2);
  background: rgba(241, 249, 253, 0.94);
}

th,
.history-table th {
  border-color: rgba(141, 220, 255, 0.23);
  background: linear-gradient(135deg, #0a1d59, #0758a6);
  color: #ffffff;
}

td,
.history-table td {
  border-color: rgba(7, 88, 166, 0.13);
  background: rgba(235, 247, 252, 0.91);
}

tbody tr:nth-child(even) td {
  background: rgba(217, 240, 249, 0.9);
}

input,
select,
textarea,
.patient-search-field,
.patient-rail-search,
.role-preview,
.login-help {
  border-color: rgba(7, 88, 166, 0.26);
  background: rgba(239, 249, 253, 0.96);
}

.workspace-tabs,
.access-tabs {
  border-color: rgba(7, 88, 166, 0.21);
  background: rgba(210, 235, 247, 0.84);
}

.workspace-tab.active,
.access-tab.active {
  background: linear-gradient(135deg, var(--reference-blue), var(--reference-blue-bright));
  color: #ffffff;
}

.workspace-tab.active::after {
  background: #8ddcff;
}

.primary-btn,
.success-btn {
  border-color: #0758a6;
  background: linear-gradient(135deg, #087fc1, #0758a6 58%, #061f55);
  color: #ffffff;
}

.secondary-btn,
.soft-btn,
.compact-btn,
.voice-btn,
.voice-done-btn {
  border-color: rgba(7, 88, 166, 0.3);
  background: rgba(218, 240, 250, 0.94);
  color: #061f55;
}

.metric-card::before,
.metric-icon,
.feature-icon,
.row-avatar,
.staff-assignment-avatar,
.assigned-patient-number,
.exercise-number,
.patient-detail-avatar,
.registration-guidance-icon,
.patient-detail-empty-icon,
.access-empty-icon,
.audit-placeholder-icon,
.role-policy-notice-icon {
  border-color: rgba(7, 88, 166, 0.28);
  background-color: rgba(7, 88, 166, 0.13);
  color: #0758a6;
}

/* Notes Form icon: explicitly flat, with no shadow or filter in every location. */
.brand-icon,
.login-brand .brand-icon,
.auth-brand .brand-icon,
.auth-story .brand-icon,
.sidebar-brand .brand-icon {
  box-shadow: none !important;
  filter: none !important;
}

/* Consistent, fully visible vector-mask icons. */
.nav-btn::before,
.tab-icon,
.metric-icon,
.feature-icon,
.patient-detail-empty-icon,
.access-empty-icon,
.registration-guidance-icon,
.audit-placeholder-icon,
.note-dialog-icon::before,
.role-policy-notice-icon {
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat !important;
  -webkit-mask-position: center !important;
  -webkit-mask-size: contain !important;
  mask-repeat: no-repeat !important;
  mask-position: center !important;
  mask-size: contain !important;
  opacity: 1;
}

.nav-btn::before {
  width: 21px;
  height: 21px;
  flex-basis: 21px;
}

.nav-btn[data-page="patientPage"]::before {
  -webkit-mask-image: var(--icon-user);
  mask-image: var(--icon-user);
}

.nav-btn[data-page="patientAssignment"]::before {
  -webkit-mask-image: var(--icon-clipboard-user);
  mask-image: var(--icon-clipboard-user);
}

.nav-btn[data-page="exercises"]::before,
.tab-icon-exercises {
  -webkit-mask-image: var(--icon-dumbbell);
  mask-image: var(--icon-dumbbell);
}

.nav-btn[data-page="patientHome"]::before {
  -webkit-mask-image: var(--icon-globe);
  mask-image: var(--icon-globe);
}

.access-tab-icon-audit {
  -webkit-mask-image: var(--icon-history);
  mask-image: var(--icon-history);
}

.metric-icon-notes,
.tab-icon-notes {
  -webkit-mask-image: var(--icon-note);
  mask-image: var(--icon-note);
}

.metric-icon-sessions {
  -webkit-mask-image: var(--icon-calendar);
  mask-image: var(--icon-calendar);
}

.metric-icon-patients,
.metric-icon-team {
  -webkit-mask-image: var(--icon-users);
  mask-image: var(--icon-users);
}

.sidebar-collapse-btn svg,
.mobile-menu-btn svg,
.logout-icon,
.password-toggle svg {
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .metric-card:hover,
  .patient-list-pane:hover,
  .patient-detail-pane:hover {
    border-color: rgba(8, 127, 193, 0.35);
  }

  .secondary-btn:hover,
  .soft-btn:hover,
  .compact-btn:hover,
  .voice-btn:hover,
  .voice-done-btn:hover {
    border-color: rgba(8, 127, 193, 0.42);
    background: rgba(197, 231, 246, 0.96);
    color: #061f55;
  }
}

@media (max-width: 760px) {
  .content-header {
    background: linear-gradient(135deg, var(--reference-navy), var(--reference-blue));
  }

  .main-content {
    background: linear-gradient(180deg, rgba(218, 242, 251, 0.92), rgba(201, 232, 246, 0.88));
  }
}


/* Final contrast corrections for previously glass-styled components. */
.registration-guidance {
  border-color: rgba(141, 220, 255, 0.3);
  background:
    radial-gradient(circle at 88% 82%, rgba(8, 127, 193, 0.42), transparent 13rem),
    linear-gradient(145deg, var(--reference-navy) 0%, #0a1d59 48%, var(--reference-blue) 100%);
  color: #ffffff;
}

.registration-guidance .eyebrow {
  color: #8ddcff;
}

.registration-guidance h3 {
  color: #ffffff;
}

.registration-guidance > p:not(.eyebrow),
.registration-guidance li {
  color: #d9ebfa;
}

.registration-guidance-icon {
  border: 0;
  background-color: #8ddcff !important;
}

.metric-card:has(.metric-icon) .metric-icon,
.metric-card .metric-icon {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  border: 0;
  border-radius: 0;
  background: #0758a6;
  color: #0758a6;
  box-shadow: none;
}

.metric-card::before {
  width: 54px;
  height: 54px;
  border-color: rgba(7, 88, 166, 0.25);
  background: linear-gradient(145deg, rgba(217, 241, 251, 0.98), rgba(185, 222, 241, 0.88));
  opacity: 1;
}

.empty-state::before,
.compact-empty-state::before,
.empty-state svg,
.compact-empty-state svg {
  color: #356f9f;
  opacity: 0.9;
}

/* Requested visual refinements — centered login and flat date pill */
.auth-layout {
  width: min(560px, 100%);
  min-height: 0;
  display: block;
  margin: 0 auto;
}

.auth-layout::before,
.auth-layout::after {
  content: none !important;
  display: none !important;
}

.login-card {
  grid-column: auto;
  grid-row: auto;
  width: 100%;
  margin: 0 auto;
}

.header-pill {
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}

/* Login password visibility icon: use one SVG so toggling can never render two eyes. */
#togglePasswordBtn .password-eye-icon {
  display: block;
}

#togglePasswordBtn .password-eye-slash {
  opacity: 0;
  transition: opacity var(--ease);
}

#togglePasswordBtn[aria-pressed="true"] .password-eye-slash {
  opacity: 1;
}

/* ========================================================================== */
/* Notes Form 2026 light glass system                                         */
/* Final authoritative theme: preserve the original teal / navy brand while  */
/* matching the supplied soft-glass and restrained-neumorphism references.    */
/* ========================================================================== */

:root {
  --canvas: #ddf7f8;
  --canvas-strong: #c9eef3;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-subtle: rgba(239, 252, 253, 0.78);
  --surface-muted: rgba(221, 246, 249, 0.86);
  --ink: #12385f;
  --ink-strong: #092f63;
  --ink-soft: #315a7c;
  --muted: #4e6f8c;
  --muted-light: #66869f;
  --line: rgba(8, 125, 159, 0.15);
  --line-strong: rgba(8, 125, 159, 0.26);
  --nav: #123f82;
  --nav-text: #092f63;
  --nav-muted: #4e6f8c;
  --primary: #087d9f;
  --primary-hover: #066a8d;
  --primary-active: #07537d;
  --primary-soft: rgba(12, 181, 203, 0.13);
  --primary-line: rgba(8, 125, 159, 0.29);
  --focus: #07537d;
  --accent-cyan: #0cb5cb;
  --accent-cyan-soft: #79e4f0;
  --reference-navy: #092f63;
  --reference-navy-deep: #06274f;
  --reference-blue: #087d9f;
  --reference-blue-bright: #0cb5cb;
  --reference-light-blue: #ddf7f8;
  --reference-light-blue-strong: #c9eef3;
  --glass: rgba(255, 255, 255, 0.70);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-soft: rgba(242, 253, 254, 0.60);
  --glass-line: rgba(255, 255, 255, 0.86);
  --shadow-xs: 0 2px 7px rgba(5, 60, 96, 0.05);
  --shadow-sm:
    9px 11px 25px rgba(5, 60, 96, 0.08),
    -6px -6px 18px rgba(255, 255, 255, 0.78),
    inset 0 1px 0 rgba(255, 255, 255, 0.90);
  --shadow-md:
    13px 16px 34px rgba(5, 60, 96, 0.10),
    -8px -8px 24px rgba(255, 255, 255, 0.80),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --shadow-lg:
    20px 24px 54px rgba(5, 48, 88, 0.14),
    -10px -10px 28px rgba(255, 255, 255, 0.82),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --shadow-inset:
    inset 3px 3px 9px rgba(5, 60, 96, 0.065),
    inset -3px -3px 9px rgba(255, 255, 255, 0.90);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 16px;
  --radius-xl: 21px;
  --ease: 180ms cubic-bezier(0.2, 0, 0, 1);
}

html,
body {
  background:
    radial-gradient(circle at 8% 90%, rgba(12, 181, 203, 0.15), transparent 23rem),
    radial-gradient(circle at 82% 9%, rgba(255, 255, 255, 0.92), transparent 30rem),
    linear-gradient(145deg, #e8fbfc 0%, var(--canvas) 52%, #cceff4 100%);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
h4,
strong {
  color: var(--ink-strong);
  font-family: "Plus Jakarta Sans", "Segoe UI Variable Display", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid rgba(7, 83, 125, 0.30);
  outline-offset: 2px;
}

/* Login */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(20px, 5vh, 56px) clamp(18px, 5vw, 72px);
  background:
    linear-gradient(122deg, transparent 0 72%, rgba(12, 181, 203, 0.08) 72% 72.15%, transparent 72.15%),
    radial-gradient(circle at 12% 90%, rgba(8, 125, 159, 0.18), transparent 21rem),
    radial-gradient(circle at 90% 4%, rgba(255, 255, 255, 0.96), transparent 32rem);
}

.auth-layout {
  width: min(1250px, 100%);
  min-height: min(820px, calc(100dvh - clamp(40px, 10vh, 112px)));
  display: grid;
  grid-template-columns: minmax(360px, 0.93fr) minmax(450px, 1.07fr);
  gap: clamp(42px, 6vw, 88px);
  align-items: center;
  margin: 0 auto;
}

.auth-layout::before,
.auth-layout::after {
  content: none !important;
  display: none !important;
}

.auth-story,
.login-card {
  border: 1px solid var(--glass-line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.77), rgba(235, 250, 252, 0.54));
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(26px) saturate(1.06);
  backdrop-filter: blur(26px) saturate(1.06);
}

.auth-story {
  position: relative;
  display: block;
  min-height: min(760px, calc(100dvh - 128px));
  overflow: hidden;
  border-radius: 30px;
  isolation: isolate;
}

.auth-story::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 16% -23% -13% -35%;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 46% 54% 52% 48% / 45% 38% 62% 55%;
  background:
    radial-gradient(circle at 53% 41%, rgba(255, 255, 255, 0.80), transparent 13rem),
    linear-gradient(145deg, rgba(12, 181, 203, 0.13), rgba(8, 125, 159, 0.04));
  transform: rotate(-9deg);
}

.auth-story::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -22%;
  bottom: -18%;
  width: 72%;
  aspect-ratio: 1;
  border: 1px solid rgba(12, 181, 203, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 54px rgba(12, 181, 203, 0.035), 0 0 0 108px rgba(8, 125, 159, 0.025);
}

.auth-story-dots {
  position: absolute;
  top: 52px;
  left: 52px;
  width: 112px;
  height: 82px;
  opacity: 0.68;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.94) 3px, transparent 3.5px);
  background-size: 28px 28px;
}

.auth-story-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
}

.orbit-one { top: 13%; right: -28%; width: 76%; aspect-ratio: 1; }
.orbit-two { bottom: 7%; left: -41%; width: 88%; aspect-ratio: 1; }

.auth-story-clipboard,
.auth-story-stat,
.auth-story-checklist,
.auth-story-shield {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: rgba(235, 251, 253, 0.62);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.auth-story-clipboard {
  top: 37%;
  left: 16%;
  width: 35%;
  aspect-ratio: 0.77;
  border-radius: 24px;
  transform: rotate(-8deg);
}

.auth-story-clip {
  position: absolute;
  top: -16px;
  left: 34%;
  width: 32%;
  height: 35px;
  border: 8px solid rgba(8, 125, 159, 0.25);
  border-radius: 13px;
}

.auth-story-cross::before,
.auth-story-cross::after {
  content: "";
  position: absolute;
  top: 30%;
  left: 50%;
  width: 46%;
  height: 16%;
  border-radius: 9px;
  background: rgba(12, 181, 203, 0.44);
  transform: translate(-50%, -50%);
}

.auth-story-cross::after { transform: translate(-50%, -50%) rotate(90deg); }

.auth-story-line {
  position: absolute;
  left: 26%;
  width: 53%;
  height: 9px;
  border-radius: 999px;
  background: rgba(8, 125, 159, 0.19);
}

.auth-story-line.line-one { bottom: 28%; }
.auth-story-line.line-two { bottom: 20%; width: 42%; }

.auth-story-stat {
  width: 36%;
  height: 14%;
  border-radius: 20px;
}

.stat-profile { top: 25%; right: 14%; }
.stat-chart { top: 49%; right: 10%; }

.stat-profile span {
  position: absolute;
  top: 25%;
  left: 10%;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(12, 181, 203, 0.38), rgba(255, 255, 255, 0.68));
}

.stat-profile i,
.stat-chart i {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: rgba(8, 125, 159, 0.14);
}

.stat-profile i:nth-of-type(1) { top: 34%; left: 45%; width: 43%; height: 9px; }
.stat-profile i:nth-of-type(2) { top: 58%; left: 45%; width: 31%; height: 8px; }
.stat-chart { display: flex; align-items: end; justify-content: center; gap: 9%; padding: 14% 15%; }
.stat-chart i { position: static; width: 12%; background: rgba(8, 125, 159, 0.22); }
.stat-chart i:nth-child(1) { height: 30%; }
.stat-chart i:nth-child(2) { height: 54%; }
.stat-chart i:nth-child(3) { height: 78%; }
.stat-chart i:nth-child(4) { height: 45%; }

.auth-story-checklist {
  left: 36%;
  bottom: 16%;
  width: 33%;
  height: 20%;
  padding: 13% 12% 8%;
  border-radius: 22px;
}

.auth-story-checklist i {
  display: block;
  width: 75%;
  height: 8px;
  margin: 0 0 15px 25%;
  border-radius: 999px;
  background: rgba(8, 125, 159, 0.16);
}

.auth-story-checklist i::before {
  content: "";
  display: block;
  width: 9px;
  height: 5px;
  margin-left: -21px;
  border-bottom: 3px solid rgba(12, 181, 203, 0.58);
  border-left: 3px solid rgba(12, 181, 203, 0.58);
  transform: rotate(-45deg);
}

.auth-story-shield {
  right: 12%;
  bottom: 11%;
  width: 20%;
  aspect-ratio: 0.86;
  border-radius: 20px;
}

.auth-story-shield span {
  position: absolute;
  inset: 20%;
  background: rgba(12, 181, 203, 0.29);
  clip-path: polygon(50% 0, 90% 18%, 84% 67%, 50% 100%, 16% 67%, 10% 18%);
}

.login-card {
  grid-column: auto;
  grid-row: auto;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: clamp(34px, 5vw, 64px);
  border-radius: 30px;
}

.login-brand {
  justify-content: center;
  margin-bottom: 42px;
}

.login-brand strong { font-size: 1.55rem; }
.login-brand small { color: var(--muted); }

.login-card-header {
  margin-bottom: 30px;
  text-align: center;
}

.login-card-header .eyebrow {
  margin-bottom: 7px;
  color: var(--primary);
}

.login-card-header h2 {
  margin-bottom: 10px;
  font-size: clamp(1.75rem, 3vw, 2.1rem);
}

.login-form { gap: 20px; }

.login-field label {
  color: var(--ink-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.login-card input,
.password-control {
  min-height: 56px;
  border-color: var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-inset);
}

.login-card .primary-btn { min-height: 56px; margin-top: 5px; }

.login-help {
  border-color: var(--line);
  background: rgba(239, 252, 253, 0.68);
  box-shadow: var(--shadow-inset);
}

/* Main application shell */
.app-shell {
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 14px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px;
  background: transparent;
}

.sidebar {
  top: 14px;
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  padding: 24px 16px 18px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.84), rgba(237, 251, 252, 0.66));
  color: var(--ink);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(26px) saturate(1.08);
  backdrop-filter: blur(26px) saturate(1.08);
}

.sidebar::before {
  top: auto;
  right: -92px;
  bottom: 8%;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(8, 125, 159, 0.10);
  background: radial-gradient(circle, rgba(12, 181, 203, 0.09), transparent 67%);
  box-shadow: 0 0 0 52px rgba(12, 181, 203, 0.025);
}

.sidebar::after {
  left: -120px;
  bottom: -175px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(8, 125, 159, 0.10);
  border-radius: 50%;
  box-shadow: 0 0 0 48px rgba(12, 181, 203, 0.025);
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar-brand { min-height: 52px; margin-bottom: 14px; padding: 0 8px; }
.sidebar-brand strong,
.sidebar-user strong { color: var(--ink-strong); }
.sidebar-brand small,
.sidebar-user small { color: var(--muted); }
.sidebar-brand .brand-icon { background: transparent; color: var(--primary); box-shadow: none; }

.nav-section-label {
  color: var(--primary);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
}

.nav-btn {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink-soft);
  font-size: 0.87rem;
  font-weight: 600;
}

.nav-btn::before { background-color: currentColor; opacity: 0.84; }

.nav-btn.active {
  border-color: rgba(8, 125, 159, 0.17);
  background: linear-gradient(145deg, rgba(221, 247, 248, 0.94), rgba(255, 255, 255, 0.76));
  color: var(--primary-active);
  box-shadow:
    7px 8px 18px rgba(5, 60, 96, 0.09),
    -5px -5px 14px rgba(255, 255, 255, 0.84),
    inset 3px 0 0 var(--accent-cyan);
}

.sidebar-user {
  border-color: var(--line);
  border-radius: 18px;
  background: rgba(239, 252, 253, 0.68);
  box-shadow: var(--shadow-inset);
}

.sidebar-user::before { border-color: var(--primary-line); background-color: var(--accent-cyan); }

.sidebar-user .secondary-btn,
.sidebar-collapse-btn {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.66);
  color: var(--primary-active);
  box-shadow: var(--shadow-xs);
}

.content-area {
  min-width: 0;
  min-height: calc(100dvh - 28px);
  overflow: clip;
  border: 1px solid var(--glass-line);
  border-radius: 26px;
  background: rgba(246, 253, 254, 0.57);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(24px) saturate(1.06);
  backdrop-filter: blur(24px) saturate(1.06);
}

.content-header {
  top: 0;
  min-height: 92px;
  margin: 0;
  padding: 18px clamp(24px, 3vw, 38px);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 26px 26px 0 0;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(5, 60, 96, 0.055);
  -webkit-backdrop-filter: blur(23px) saturate(1.08);
  backdrop-filter: blur(23px) saturate(1.08);
}

.content-header .eyebrow,
.content-header h1 { color: var(--ink-strong); }
.content-header .eyebrow { color: var(--primary); }
.content-header h1 { font-size: clamp(1.75rem, 2.6vw, 2.15rem); font-weight: 700; }

.header-pill {
  min-height: 42px;
  padding: 9px 15px;
  border-color: var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.70);
  color: var(--ink-soft);
  box-shadow: var(--shadow-inset) !important;
}

.header-pill::before { background-color: var(--primary); }

.main-content {
  width: 100%;
  max-width: none;
  gap: 22px;
  padding: clamp(20px, 2.6vw, 34px);
  background: transparent;
}

/* Shared glass cards, controls, tables, and buttons */
.card,
.management-panel,
.ta-patient-section,
.patient-workspace,
.staff-assignment-card,
.patient-assignment,
.page-intro-card,
.permissions-hero,
.accounts-management-hero,
.patient-list-pane,
.patient-detail-pane,
.access-summary,
.registration-guidance,
.access-category,
.role-permission-card,
.audit-placeholder {
  border-color: var(--line);
  border-radius: 20px;
  background: var(--glass);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  backdrop-filter: blur(18px) saturate(1.05);
}

.registration-guidance {
  background:
    radial-gradient(circle at 89% 83%, rgba(12, 181, 203, 0.14), transparent 13rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(229, 249, 251, 0.68));
  color: var(--ink);
}

.registration-guidance h3,
.registration-guidance > p:not(.eyebrow),
.registration-guidance li { color: var(--ink); }
.registration-guidance .eyebrow { color: var(--primary); }

.card-header,
.section-header,
.panel-header {
  border-color: var(--line);
  background: linear-gradient(145deg, rgba(242, 253, 254, 0.76), rgba(255, 255, 255, 0.46));
}

.metric-card:has(.metric-icon) .metric-icon,
.metric-card .metric-icon {
  color: var(--primary);
  background: var(--primary);
}

.metric-card::before {
  border-color: rgba(8, 125, 159, 0.16);
  background: linear-gradient(145deg, rgba(232, 251, 252, 0.98), rgba(202, 240, 244, 0.82));
}

input,
select,
textarea,
.password-control,
.search-inline,
.patient-search-field,
.display-date-picker-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.70);
  color: var(--ink);
  box-shadow: var(--shadow-inset);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 0 0 4px rgba(8, 125, 159, 0.12), var(--shadow-inset);
}

.primary-btn,
.success-btn {
  min-height: 42px;
  border-color: #087d9f;
  border-radius: 12px;
  background: linear-gradient(135deg, #0aa6bd, #087d9f);
  color: #fff;
  box-shadow:
    7px 9px 18px rgba(8, 125, 159, 0.19),
    -4px -4px 12px rgba(255, 255, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.29);
}

.secondary-btn,
.soft-btn,
.compact-btn,
.voice-btn,
.voice-done-btn,
.history-actions-trigger,
.account-actions-menu > summary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary-active);
  box-shadow: var(--shadow-xs);
}

.table-wrap,
.history-table-wrap,
.list-row,
.note-card,
.exercise-row,
.readonly-note,
.readonly-detail-block,
.staff-assignment-header,
.assignment-toolbar,
.assigned-patient-row,
.note-input-block,
.checkbox-card,
.modal-checkbox-card,
.patient-exercise-panel,
.patient-exercise-option,
.current-exercise-meta,
.current-exercise-item,
.patient-exercise-schedule,
.provider-note-entry,
.patient-note-row,
.history-view-note-row,
.access-record,
.patient-rail-item {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.61);
  color: var(--ink);
}

.table-wrap,
.history-table-wrap {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow-inset);
}

th {
  background: rgba(221, 247, 248, 0.74);
  color: var(--ink-soft);
}

td { background: rgba(255, 255, 255, 0.38); }
tbody tr:hover td { background: rgba(221, 247, 248, 0.52); }

.badge.soft {
  border-color: rgba(8, 125, 159, 0.15);
  background: rgba(221, 247, 248, 0.78);
  color: var(--primary-active);
}

@media (hover: hover) {
  .nav-btn:hover { background: rgba(12, 181, 203, 0.09); color: var(--primary-active); }
  .nav-btn.active:hover { background: linear-gradient(145deg, rgba(221, 247, 248, 0.98), rgba(255, 255, 255, 0.84)); color: var(--primary-active); }
  .primary-btn:hover,
  .success-btn:hover { background: linear-gradient(135deg, #0794ad, #066a8d); }
  .secondary-btn:hover,
  .soft-btn:hover,
  .compact-btn:hover,
  .voice-btn:hover,
  .voice-done-btn:hover { border-color: var(--primary-line); background: rgba(221, 247, 248, 0.82); color: var(--primary-active); }
}

/* Patient portal exercise program */
.patient-workspace {
  display: grid;
  gap: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.patient-portal-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 160px;
  overflow: hidden;
  padding: clamp(24px, 3vw, 38px);
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 82% 48%, rgba(255, 255, 255, 0.92), transparent 12rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(218, 246, 249, 0.72));
  box-shadow: var(--shadow-sm);
}

.patient-portal-hero::before {
  content: "";
  position: absolute;
  right: -4%;
  bottom: -84%;
  width: 43%;
  aspect-ratio: 1.7;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(155deg, rgba(12, 181, 203, 0.20), rgba(8, 125, 159, 0.05));
  transform: rotate(-8deg);
}

.patient-portal-hero > * { position: relative; z-index: 1; }
.patient-portal-hero h2 { margin-bottom: 9px; font-size: clamp(1.7rem, 3.2vw, 2.35rem); }
.patient-portal-hero p:last-child { max-width: 700px; margin-bottom: 0; color: var(--muted); }

.patient-progress-orb {
  --progress: 0%;
  display: grid;
  flex: 0 0 auto;
  width: 108px;
  aspect-ratio: 1;
  place-content: center;
  border: 1px solid rgba(255, 255, 255, 0.90);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(232, 251, 252, 0.94), rgba(255, 255, 255, 0.76));
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  text-align: center;
}

.patient-progress-orb strong { font-size: 1.45rem; }
.patient-progress-orb span { color: var(--muted); font-size: 0.72rem; }

.portal-program-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background: var(--glass);
  box-shadow: var(--shadow-sm);
}

.patient-program-header,
.patient-program-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(242, 253, 254, 0.73), rgba(255, 255, 255, 0.46));
}

.patient-program-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 14px;
}

.patient-program-icon {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(8, 125, 159, 0.15);
  border-radius: 15px;
  background: rgba(221, 247, 248, 0.80);
  color: var(--primary);
  box-shadow: var(--shadow-inset);
}

.patient-program-icon svg { width: 25px; }
.patient-program-header .eyebrow { margin-bottom: 3px; }
.patient-program-header h3 { margin: 0 0 4px; font-size: 1.12rem; }
.patient-program-header p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 0.79rem; }

.patient-program-summary {
  display: grid;
  min-width: 100px;
  text-align: right;
}

.patient-program-summary strong { font-size: 1.35rem; }
.patient-program-summary span { color: var(--muted); font-size: 0.74rem; }

.portal-exercise-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px;
}

.portal-exercise-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 88px minmax(0, 1fr);
  grid-template-areas:
    "sequence visual copy"
    "sequence visual action";
  gap: 10px 16px;
  min-height: 216px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.69);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease), opacity var(--ease);
}

.portal-exercise-card.is-current {
  border-color: rgba(8, 125, 159, 0.34);
  box-shadow: 0 0 0 3px rgba(12, 181, 203, 0.08), var(--shadow-sm);
}

.portal-exercise-card.is-locked { opacity: 0.62; box-shadow: var(--shadow-inset); }
.portal-exercise-card.is-complete { border-color: rgba(6, 118, 71, 0.20); }

.portal-exercise-sequence {
  grid-area: sequence;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.is-locked .portal-exercise-sequence { background: #8299aa; }
.is-complete .portal-exercise-sequence { background: var(--success); }

.portal-exercise-visual {
  grid-area: visual;
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  align-self: start;
  border: 1px solid rgba(255, 255, 255, 0.89);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(226, 250, 251, 0.98), rgba(169, 231, 239, 0.76));
  color: var(--primary);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.portal-exercise-visual svg { width: 43px; height: 43px; }
.portal-exercise-copy { grid-area: copy; min-width: 0; }
.portal-exercise-card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

.portal-exercise-category,
.portal-exercise-state {
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.portal-exercise-category { color: var(--primary); }
.portal-exercise-state { padding: 4px 8px; border-radius: 999px; background: rgba(221, 247, 248, 0.82); color: var(--primary-active); }
.portal-exercise-state.active { background: #fff3e7; color: #9a4c0b; }
.portal-exercise-state.complete { background: var(--success-soft); color: var(--success); }
.portal-exercise-state.note { background: #f3efff; color: #6941c6; }

.portal-exercise-card h4 { margin: 0 0 7px; font-size: 1rem; }
.portal-exercise-card p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }

.portal-exercise-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.7rem;
}

.portal-duration-icon,
.portal-lock-icon,
.patient-program-security-icon {
  display: inline-block;
  width: 15px;
  height: 15px;
  background-color: currentColor;
  -webkit-mask: var(--icon-history) center / contain no-repeat;
  mask: var(--icon-history) center / contain no-repeat;
}

.portal-lock-icon { -webkit-mask-image: var(--icon-lock); mask-image: var(--icon-lock); }
.patient-program-security-icon { flex: 0 0 18px; width: 18px; height: 18px; color: var(--primary); -webkit-mask-image: var(--icon-shield); mask-image: var(--icon-shield); }
.portal-note-saved { color: var(--success); font-weight: 650; }

.portal-exercise-action { grid-area: action; align-self: end; }
.portal-start-btn { width: 100%; min-height: 44px; justify-content: center; }

.patient-program-footer {
  justify-content: flex-start;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  padding-block: 14px;
}

.patient-program-footer p { flex: 1; margin: 0; color: var(--muted); font-size: 0.76rem; }

/* Care-team live exercise monitor */
.exercise-row:has(.staff-exercise-monitor) {
  grid-template-columns: minmax(92px, 0.58fr) minmax(160px, 1.2fr) minmax(190px, 1.45fr) minmax(184px, 0.9fr);
  align-items: center;
}

.staff-exercise-monitor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 12px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(239, 252, 253, 0.70);
  box-shadow: var(--shadow-inset);
}

.staff-exercise-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.live-status-dot {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8da4b5;
  box-shadow: 0 0 0 4px rgba(141, 164, 181, 0.12);
}

.staff-exercise-monitor.active .live-status-dot,
.experience-live-title .live-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(6, 118, 71, 0.13);
  animation: live-session-pulse 1.6s ease-out infinite;
}

.staff-exercise-monitor.breathing .live-status-dot { background: #6941c6; box-shadow: 0 0 0 4px rgba(105, 65, 198, 0.12); }
.staff-exercise-monitor.complete .live-status-dot { background: var(--success); }

.live-session-clock,
.experience-live-clock {
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.live-session-clock { font-size: 0.86rem; }

.monitor-stop-btn {
  grid-column: 1 / -1;
  min-height: 44px;
  justify-content: center;
}

@keyframes live-session-pulse {
  0% { box-shadow: 0 0 0 0 rgba(6, 118, 71, 0.28); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(6, 118, 71, 0); }
}

/* Edge-to-edge patient exercise workflow */
.patient-experience-backdrop {
  position: fixed !important;
  z-index: 5000 !important;
  inset: 0 !important;
  display: block !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: linear-gradient(145deg, #eafcfd, #d1f1f5) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.patient-experience-dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 255, 255, 0.96), transparent 32rem),
    radial-gradient(circle at 7% 92%, rgba(12, 181, 203, 0.14), transparent 28rem),
    linear-gradient(145deg, #eafcfd, #d1f1f5);
  box-shadow: none;
}

.patient-experience-screen {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.patient-experience-intro,
.patient-experience-results,
.patient-experience-note,
.patient-experience-saved {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: max(26px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

.patient-experience-results {
  align-items: flex-start;
}

.patient-experience-results > .experience-results-card {
  margin-block: auto;
}

.experience-close-btn {
  position: fixed;
  z-index: 3;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-strong);
  box-shadow: var(--shadow-sm);
  font-size: 1.45rem;
  line-height: 1;
}

.experience-intro-card,
.experience-results-card,
.experience-note-card,
.experience-saved-card {
  width: min(720px, 100%);
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--glass-line);
  border-radius: 28px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-lg);
  text-align: center;
  -webkit-backdrop-filter: blur(24px) saturate(1.06);
  backdrop-filter: blur(24px) saturate(1.06);
}

.experience-intro-art {
  display: grid;
  width: 112px;
  height: 112px;
  margin: 0 auto 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(225, 250, 252, 0.98), rgba(154, 224, 234, 0.70));
  color: var(--primary);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.experience-intro-art svg { width: 54px; height: 54px; }
.experience-step-kicker { display: block; margin-bottom: 9px; color: var(--primary); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.10em; text-transform: uppercase; }
.experience-intro-card h2,
.experience-results-card h2,
.experience-note-card h2,
.experience-saved-card h2 { margin-bottom: 12px; font-size: clamp(1.65rem, 4vw, 2.5rem); }
.experience-intro-card > p,
.experience-results-card > p,
.experience-note-card > p { max-width: 590px; margin-inline: auto; color: var(--muted); }

.experience-detail-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 24px 0;
}

.experience-detail-pills span,
.breathing-duration-chip {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(221, 247, 248, 0.72);
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 700;
}

.experience-how-it-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 26px 0;
}

.experience-how-it-works div {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(242, 253, 254, 0.70);
  color: var(--muted);
  font-size: 0.73rem;
}

.experience-how-it-works strong {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
}

.experience-primary-action { width: min(360px, 100%); min-height: 50px; justify-content: center; margin-top: 4px; }

.patient-experience-active,
.patient-experience-breathing {
  flex-direction: column;
}

.experience-live-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  min-height: 78px;
  padding: max(14px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 8px 24px rgba(5, 60, 96, 0.07);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.experience-live-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.experience-live-title > div { display: grid; min-width: 0; }
.experience-live-title span { color: var(--muted); font-size: 0.7rem; }
.experience-live-title strong { overflow: hidden; font-size: 0.94rem; text-overflow: ellipsis; white-space: nowrap; }
.experience-live-clock { min-width: 100px; font-size: 1.38rem; text-align: center; }
.experience-finish-btn { min-width: 142px; }

.breathing-header-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: rgba(221, 247, 248, 0.85);
  color: var(--primary);
  box-shadow: var(--shadow-inset);
}

.breathing-header-icon svg { width: 23px; }

.experience-game-stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #f3fcfd;
}

.experience-game-frame {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: #fff;
}

.balance-handoff-handoff-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
  width: min(980px, calc(100% - 40px));
  min-width: 0;
  max-width: 100%;
  margin: auto;
  padding: clamp(28px, 5vw, 58px);
  overflow-y: auto;
  border: 1px solid var(--glass-line);
  border-radius: 28px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-lg);
}

.balance-handoff-composite-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  background: #f3fcfd;
}

.balance-handoff-composite-overlay .balance-handoff-handoff-card {
  max-height: calc(100% - 40px);
  -webkit-overflow-scrolling: touch;
}

.balance-handoff-handoff-card-warning {
  grid-template-columns: minmax(0, 1fr) minmax(190px, 280px);
  border-color: color-mix(in srgb, var(--warning) 22%, var(--glass-line));
}

.balance-handoff-handoff-copy,
.balance-handoff-qr-panel,
.balance-handoff-handoff-security {
  min-width: 0;
}

.balance-handoff-handoff-copy h2 {
  margin: 0 0 12px;
  color: var(--ink-strong);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.balance-handoff-handoff-copy > p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.balance-handoff-handoff-security {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.balance-handoff-handoff-security > span {
  position: relative;
  width: 19px;
  height: 15px;
  flex: 0 0 19px;
  border: 2px solid var(--primary-active);
  border-radius: 4px;
}

.balance-handoff-handoff-security > span::before {
  content: '';
  position: absolute;
  left: 3px;
  top: -9px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--primary-active);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.balance-handoff-handoff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.balance-handoff-handoff-actions button { min-height: 44px; }

.balance-handoff-link-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, var(--primary-soft));
}

.balance-handoff-option-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 50%;
  background: #0EA5E9;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  box-shadow: 0 5px 12px rgba(14, 165, 233, 0.2);
}

.balance-handoff-option-copy,
.balance-handoff-option-heading > div { min-width: 0; }

.balance-handoff-option-copy > strong,
.balance-handoff-option-heading strong {
  color: var(--ink-strong);
  font-size: 0.9rem;
}

.balance-handoff-option-copy > p,
.balance-handoff-option-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.balance-handoff-phone-link {
  display: block;
  max-width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #0EA5E9 24%, var(--line));
  border-radius: 11px;
  background: #fff;
  color: #0B7FB0;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-handoff-option-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  text-align: left;
}

.balance-handoff-qr-panel {
  display: grid;
  justify-items: center;
  gap: 13px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.balance-handoff-qr-panel img {
  display: block;
  width: min(248px, 100%);
  height: auto;
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 14px;
  background: #fff;
}

.balance-handoff-qr-panel > a {
  color: var(--primary-active);
  font-size: 0.72rem;
  font-weight: 750;
}

.balance-handoff-waiting-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 700;
}

.balance-handoff-waiting-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(12, 181, 203, 0.35);
  animation: balance-handoff-waiting-pulse 1.5s ease-out infinite;
}

.balance-handoff-waiting-status[data-state="error"] {
  color: var(--danger);
}

.balance-handoff-waiting-status[data-state="error"] .balance-handoff-waiting-dot {
  background: var(--danger);
  animation: none;
}

.balance-handoff-setup-symbol {
  position: relative;
  display: grid;
  width: clamp(150px, 22vw, 210px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border: 1px solid color-mix(in srgb, var(--warning) 24%, var(--line));
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.94), transparent 34%),
    linear-gradient(145deg, #fffdf7, var(--warning-soft));
  color: var(--warning);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.balance-handoff-setup-symbol > span {
  position: relative;
  width: 68px;
  height: 108px;
  border: 6px solid currentColor;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.88);
}

.balance-handoff-setup-symbol > span::before,
.balance-handoff-setup-symbol > span::after {
  content: '';
  position: absolute;
  left: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.balance-handoff-setup-symbol > span::before {
  top: 7px;
  width: 23px;
  height: 3px;
  border-radius: 999px;
}

.balance-handoff-setup-symbol > span::after {
  bottom: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.balance-handoff-setup-symbol::after {
  content: '!';
  position: absolute;
  right: 19%;
  bottom: 17%;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1;
}

.balance-handoff-setup-symbol.is-expired {
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.94), transparent 34%),
    linear-gradient(145deg, #fff, var(--danger-soft));
  color: var(--danger);
}

.balance-handoff-setup-symbol.is-expired::after {
  content: '\00d7';
  background: var(--danger);
}

@keyframes balance-handoff-waiting-pulse {
  70%, 100% { box-shadow: 0 0 0 8px rgba(12, 181, 203, 0); }
}

/* Balance Steps accent touch-up for the phone hand-off screen (non-semantic brand color only). */
.balance-handoff-composite-overlay {
  background: #f2f6ff;
}

.balance-handoff-handoff-security > span,
.balance-handoff-handoff-security > span::before {
  border-color: #0EA5E9;
}

.balance-handoff-qr-panel > a {
  color: #0EA5E9;
}

.balance-handoff-waiting-dot {
  background: #0EA5E9;
  box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.35);
  animation-name: sq-handoff-waiting-pulse;
}

@keyframes sq-handoff-waiting-pulse {
  70%, 100% { box-shadow: 0 0 0 8px rgba(14, 165, 233, 0); }
}

.experience-custom-placeholder {
  width: min(620px, calc(100% - 40px));
  margin: auto;
  padding: 36px;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.experience-result-mark,
.experience-note-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #e8fff4, #c9f5df);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.experience-result-mark::before {
  content: "";
  width: 27px;
  height: 15px;
  border-bottom: 4px solid var(--success);
  border-left: 4px solid var(--success);
  transform: translateY(-3px) rotate(-45deg);
}

.experience-note-icon { background: linear-gradient(145deg, #e8fbfd, #cceff3); }
.experience-note-icon::before { content: ""; width: 30px; height: 30px; background: var(--primary); -webkit-mask: var(--icon-note) center / contain no-repeat; mask: var(--icon-note) center / contain no-repeat; }

.experience-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 12px;
  margin: 28px 0;
}

.experience-result-grid > div {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(239, 252, 253, 0.72);
  box-shadow: var(--shadow-inset);
}

.experience-result-grid span { color: var(--muted); font-size: 0.7rem; }
.experience-result-grid strong { font-size: 1.05rem; }

.experience-note-card { text-align: left; }
.experience-note-card > .experience-note-icon,
.experience-note-card > .experience-step-kicker,
.experience-note-card > h2,
.experience-note-card > p { text-align: center; }
.experience-note-card label { display: block; margin-bottom: 7px; color: var(--ink-strong); font-size: 0.8rem; font-weight: 750; }
.experience-note-card textarea { width: 100%; min-height: 178px; resize: vertical; }

.experience-note-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 13px 0 20px;
}

.experience-mic-btn { min-height: 44px; }
.experience-note-card .experience-primary-action { display: flex; margin-inline: auto; }

.experience-saved-note {
  margin: 26px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(239, 252, 253, 0.70);
  box-shadow: var(--shadow-inset);
  text-align: left;
}

.experience-saved-note span { color: var(--muted); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.experience-saved-note p { margin: 7px 0 0; color: var(--ink); white-space: pre-wrap; }
.experience-saved-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.experience-saved-actions button { min-height: 46px; }

.disabled-btn,
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .auth-story,
  .login-card,
  .sidebar,
  .content-area,
  .content-header,
  .card,
  .management-panel,
  .patient-assignment,
  .experience-intro-card,
  .experience-results-card,
  .experience-note-card,
  .experience-saved-card {
    background-color: #f6fdfd;
  }
}

@media (max-width: 1180px) {
  .portal-exercise-list { grid-template-columns: 1fr; }
  .exercise-row:has(.staff-exercise-monitor) { grid-template-columns: minmax(90px, 0.65fr) minmax(150px, 1fr) minmax(190px, 1.35fr); }
  .exercise-row:has(.staff-exercise-monitor) .staff-exercise-monitor { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .auth-screen { padding: 28px; }
  .auth-layout { grid-template-columns: minmax(290px, 0.8fr) minmax(400px, 1.2fr); gap: 28px; }
  .auth-story { min-height: 650px; }

  .app-shell {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: sticky;
    top: 12px;
    z-index: 80;
    width: 100%;
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    overflow: visible;
    border-radius: 22px;
  }

  .content-area { min-height: calc(100dvh - 108px); margin-top: 12px; border-radius: 22px; }
  .content-header { min-height: 78px; border-radius: 22px 22px 0 0; }
  .patient-experience-backdrop { z-index: 5000 !important; }
}

@media (max-width: 760px) {
  .auth-screen { padding: 18px; }
  .auth-layout { display: block; min-height: 0; }
  .auth-story { display: none; }
  .login-card { max-width: 560px; padding: 30px 23px; border-radius: 24px; }
  .login-brand { margin-bottom: 28px; }

  .content-header {
    min-height: 74px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.75);
  }

  .content-header .eyebrow,
  .content-header h1 { color: var(--ink-strong); }
  .content-header .eyebrow { color: var(--primary); }
  .main-content { padding: 16px; }

  .patient-portal-hero { align-items: flex-start; min-height: 0; padding: 22px; }
  .patient-progress-orb { width: 82px; }
  .patient-program-header { align-items: flex-start; }
  .portal-exercise-list { grid-template-columns: 1fr; padding: 14px; }
  .portal-exercise-card {
    grid-template-columns: auto 70px minmax(0, 1fr);
    grid-template-areas:
      "sequence visual copy"
      "action action action";
    min-height: 0;
    padding: 16px;
  }
  .portal-exercise-visual { width: 70px; height: 70px; }
  .portal-exercise-visual svg { width: 35px; height: 35px; }
  .portal-exercise-action { margin-top: 4px; }

  .experience-live-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 70px;
    padding-inline: 14px;
  }
  .experience-live-clock { min-width: 75px; font-size: 1.05rem; }
  .experience-finish-btn { grid-column: 1 / -1; min-height: 42px; }
  .experience-game-stage { min-height: 0; }
  .balance-handoff-handoff-card {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 30px 20px;
    border: 0;
    border-radius: 0;
    overflow-x: hidden;
  }
  .balance-handoff-handoff-actions { display: grid; }
  .balance-handoff-handoff-actions button { width: 100%; }
  .balance-handoff-qr-panel { width: 100%; max-width: 360px; justify-self: center; }
  .experience-how-it-works { grid-template-columns: 1fr; }
  .experience-intro-card,
  .experience-results-card,
  .experience-note-card,
  .experience-saved-card { padding: 28px 20px; border-radius: 22px; }
}

@media (max-width: 520px) {
  .app-shell { padding: 8px; }
  .sidebar { top: 8px; border-radius: 18px; }
  .content-area { margin-top: 8px; border-radius: 18px; }
  .content-header { border-radius: 18px 18px 0 0; }
  .header-pill { display: none; }
  .patient-portal-hero { flex-direction: column; }
  .patient-progress-orb { align-self: flex-start; }
  .patient-program-header { flex-direction: column; }
  .patient-program-summary { display: flex; gap: 7px; align-items: baseline; text-align: left; }
  .portal-exercise-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "sequence visual"
      "copy copy"
      "action action";
  }
  .portal-exercise-visual { justify-self: end; }
  .patient-program-footer { flex-wrap: wrap; }
  .patient-program-footer p { min-width: calc(100% - 32px); }
  .patient-experience-intro,
  .patient-experience-results,
  .patient-experience-note,
  .patient-experience-saved { align-items: flex-start; padding: 72px 12px 16px; }
  .experience-close-btn { top: 12px; right: 12px; }
  .experience-intro-art { width: 86px; height: 86px; }
  .experience-intro-art svg { width: 42px; height: 42px; }
  .experience-saved-actions { display: grid; }
  .experience-saved-actions button { width: 100%; }
}

@media (max-height: 700px) and (min-width: 761px) {
  .auth-screen { padding-block: 20px; }
  .auth-layout { min-height: calc(100dvh - 40px); }
  .auth-story { min-height: calc(100dvh - 40px); }
  .login-card { padding-block: 28px; }
  .login-brand { margin-bottom: 20px; }
  .login-card-header { margin-bottom: 18px; }
  .login-form { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .staff-exercise-monitor.active .live-status-dot,
  .experience-live-title .live-status-dot,
  .balance-handoff-waiting-dot { animation: none; }
  .portal-exercise-card { transition: none; }
}

/* ========================================================================== */
/* Final visual refinements: original sidebar, clearer artwork, rounded states */
/* ========================================================================== */

/* Keep the original navy-to-teal character while lifting it for the glass UI. */
.sidebar {
  border-color: rgba(224, 250, 253, 0.48);
  background:
    radial-gradient(circle at 12% 76%, rgba(121, 228, 240, 0.30), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.12), transparent 15rem),
    linear-gradient(165deg, #1b557f 0%, #0d6988 53%, #0a8492 100%);
  color: rgba(247, 254, 255, 0.94);
  box-shadow:
    16px 20px 44px rgba(5, 48, 88, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.sidebar::before {
  border-color: rgba(214, 248, 251, 0.18);
  background: radial-gradient(circle, rgba(121, 228, 240, 0.22), transparent 68%);
  box-shadow: 0 0 0 52px rgba(221, 247, 248, 0.045);
}

.sidebar::after {
  border-color: rgba(221, 247, 248, 0.16);
  box-shadow: 0 0 0 48px rgba(221, 247, 248, 0.04);
}

.sidebar-brand strong,
.sidebar-user strong { color: #ffffff; }

.sidebar-brand small,
.sidebar-user small { color: rgba(226, 248, 251, 0.80); }

.sidebar-brand .brand-icon {
  color: #dffbfe;
}

.nav-section-label { color: rgba(220, 249, 252, 0.76); }

.nav-btn {
  border-radius: 15px;
  color: rgba(242, 253, 254, 0.90);
}

.nav-btn::before { opacity: 0.92; }

/* The active destination mirrors the raised, pale-cyan pill in the reference. */
.nav-btn.active {
  border-color: rgba(255, 255, 255, 0.76);
  background: linear-gradient(145deg, rgba(250, 255, 255, 0.97), rgba(211, 246, 249, 0.91));
  color: var(--primary-active);
  box-shadow:
    0 9px 22px rgba(4, 45, 75, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -1px 0 rgba(8, 125, 159, 0.10);
}

.nav-btn.active::before {
  background-color: var(--primary);
  opacity: 1;
}

.sidebar-user {
  border-color: rgba(230, 252, 254, 0.28);
  background: rgba(7, 61, 91, 0.25);
  box-shadow:
    inset 2px 2px 8px rgba(3, 43, 69, 0.16),
    inset -2px -2px 8px rgba(255, 255, 255, 0.10);
}

.sidebar-user::before {
  border-color: rgba(235, 253, 255, 0.42);
  background-color: #9cecf3;
}

.sidebar-user .secondary-btn,
.sidebar-collapse-btn {
  border-color: rgba(236, 253, 255, 0.30);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

:where(.sidebar button, .sidebar a):focus-visible {
  outline-color: rgba(222, 251, 254, 0.90);
}

@media (hover: hover) {
  .sidebar .nav-btn:hover {
    background: rgba(230, 251, 253, 0.14);
    color: #ffffff;
  }

  .sidebar .nav-btn.active:hover {
    border-color: rgba(255, 255, 255, 0.86);
    background: linear-gradient(145deg, #ffffff, rgba(218, 249, 251, 0.96));
    color: var(--primary-active);
  }

  .sidebar-user .secondary-btn:hover,
  .sidebar-collapse-btn:hover {
    border-color: rgba(239, 254, 255, 0.48);
    background: rgba(255, 255, 255, 0.19);
    color: #ffffff;
  }
}

/* Increase the contrast of the CSS illustration without changing its artwork. */
.auth-story {
  border-color: rgba(8, 125, 159, 0.26);
  background:
    radial-gradient(circle at 78% 23%, rgba(255, 255, 255, 0.88), transparent 16rem),
    linear-gradient(145deg, rgba(247, 254, 255, 0.94), rgba(186, 234, 240, 0.70));
  box-shadow:
    18px 22px 48px rgba(5, 60, 96, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.auth-story::before {
  border-color: rgba(8, 125, 159, 0.20);
  background:
    radial-gradient(circle at 53% 41%, rgba(255, 255, 255, 0.91), transparent 13rem),
    linear-gradient(145deg, rgba(12, 181, 203, 0.28), rgba(8, 125, 159, 0.10));
}

.auth-story::after {
  border-color: rgba(8, 125, 159, 0.25);
  box-shadow:
    0 0 0 54px rgba(12, 181, 203, 0.075),
    0 0 0 108px rgba(8, 125, 159, 0.045);
}

.auth-story-dots {
  opacity: 0.58;
  background-image: radial-gradient(circle, rgba(8, 125, 159, 0.72) 3px, transparent 3.5px);
}

.auth-story-orbit { border-color: rgba(8, 125, 159, 0.24); }

.auth-story-clipboard,
.auth-story-stat,
.auth-story-checklist,
.auth-story-shield {
  border-color: rgba(8, 125, 159, 0.25);
  background: rgba(235, 251, 253, 0.86);
  box-shadow:
    11px 14px 28px rgba(5, 60, 96, 0.14),
    -5px -5px 15px rgba(255, 255, 255, 0.76),
    var(--shadow-inset);
}

.auth-story-clip { border-color: rgba(8, 125, 159, 0.48); }

.auth-story-cross::before,
.auth-story-cross::after { background: rgba(12, 181, 203, 0.72); }

.auth-story-line { background: rgba(8, 125, 159, 0.32); }
.stat-profile span { background: linear-gradient(145deg, rgba(12, 181, 203, 0.62), rgba(255, 255, 255, 0.80)); }
.stat-profile i,
.stat-chart i { background: rgba(8, 125, 159, 0.28); }
.auth-story-checklist i { background: rgba(8, 125, 159, 0.29); }
.auth-story-checklist i::before { border-color: rgba(8, 125, 159, 0.84); }
.auth-story-shield span { background: rgba(12, 181, 203, 0.55); }

.login-brand .brand-icon {
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.login-brand .brand-icon svg { width: 39px; height: 39px; }

/* History headers use the same navy/teal hierarchy as the surrounding chrome. */
.history-table-wrap {
  border-radius: var(--radius-xl);
}

.history-table {
  border-collapse: separate;
  border-spacing: 0;
}

.history-table thead th {
  border-color: rgba(8, 125, 159, 0.18);
  background: var(--surface-subtle);
  color: var(--primary-active);
  font-weight: 800;
  letter-spacing: 0.065em;
  box-shadow: inset 0 -2px 0 rgba(12, 181, 203, 0.14);
}

.history-table thead th:first-child { border-top-left-radius: calc(var(--radius-xl) - 1px); }
.history-table thead th:last-child { border-top-right-radius: calc(var(--radius-xl) - 1px); }
.history-table tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--radius-xl) - 1px); }
.history-table tbody tr:last-child td:last-child { border-bottom-right-radius: calc(var(--radius-xl) - 1px); }

/* Complete the rounded system on remaining highlighted work surfaces. */
.metric-card,
.page-intro-card,
.patient-page-intro,
.patient-welcome,
.patient-session-header,
.access-control-intro,
.patient-panel-intro,
.assignment-toolbar,
.history-tools,
.workspace-tabs,
.access-tabs {
  border-radius: var(--radius-xl);
}

.history-tools {
  padding: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(242, 253, 254, 0.82), rgba(255, 255, 255, 0.62));
  box-shadow: var(--shadow-inset);
}

.card-header,
.section-header,
.panel-header,
.patient-list-pane-header,
.patient-detail-header,
.access-section-heading,
.staff-assignment-header {
  border-radius: var(--radius-lg);
}

.table-wrap,
.list-row,
.note-card,
.exercise-row,
.readonly-note,
.readonly-detail-block,
.assigned-patient-row,
.note-input-block,
.checkbox-card,
.modal-checkbox-card,
.patient-exercise-panel,
.patient-exercise-option,
.current-exercise-meta,
.current-exercise-item,
.patient-exercise-schedule,
.access-category,
.access-record,
.toolbar-result-note,
.empty-state,
.compact-empty-state {
  border-radius: var(--radius-lg);
}

/* The decorative tile and masked glyph now share the exact same grid center. */
#mainContent[data-view="overview"] .metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.metric-card {
  grid-template-columns: 54px minmax(0, 1fr);
}

.metric-card::before {
  place-self: center;
}

.metric-card:has(.metric-icon) .metric-icon,
.metric-card .metric-icon {
  display: block;
  align-self: center;
  justify-self: center;
  margin: 0;
  transform: none;
}

.experience-completion-hint {
  max-width: 260px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(221, 247, 248, 0.72);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

@media (max-width: 760px) {
  .experience-completion-hint {
    grid-column: 1 / -1;
    max-width: none;
  }
}

/* ========================================================================== */
/* Selected-state cleanup: compact tabs, quiet checks, unbroken glass cards    */
/* ========================================================================== */

/* Access Control and Patient List use a compact raised tab instead of a tab
   underline. The margin keeps the tab rail visually separate from its panel. */
:is(.access-tabs, .patient-detail-pane > .workspace-tabs) {
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 6px 8px;
}

:is(.access-tabs, .patient-detail-pane > .workspace-tabs) .workspace-tab {
  min-height: 38px;
  padding: 7px 13px;
  border-radius: 12px;
}

:is(.access-tabs, .patient-detail-pane > .workspace-tabs) .workspace-tab.active {
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(12, 181, 203, 0.96), rgba(8, 125, 159, 0.98));
  color: #ffffff;
  box-shadow:
    0 5px 12px rgba(7, 83, 125, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

:is(.access-tabs, .patient-detail-pane > .workspace-tabs) .workspace-tab.active::after {
  content: none;
  display: none;
}

:is(.access-tabs, .patient-detail-pane > .workspace-tabs) .workspace-tab:focus-visible {
  outline: 3px solid rgba(7, 83, 125, 0.30);
  outline-offset: 2px;
}

/* The summary is only a layout wrapper. Removing its own glass surface keeps
   the two counters independent and eliminates the connector between them. */
.access-control-intro .access-summary {
  gap: 10px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.access-control-intro .access-summary::before,
.access-control-intro .access-summary::after {
  content: none;
  display: none;
}

.access-control-intro .access-summary > span {
  border-radius: 14px;
  box-shadow:
    0 5px 12px rgba(7, 83, 125, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

/* A selected patient is clearer without the unrelated stripe on its left. */
.patient-rail-item.selected {
  border-color: rgba(8, 125, 159, 0.42);
  background: linear-gradient(145deg, rgba(211, 246, 249, 0.96), rgba(242, 253, 254, 0.92));
  box-shadow:
    0 6px 14px rgba(7, 83, 125, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.patient-rail-item.selected::before,
.patient-rail-item.selected::after,
.patient-exercise-option.selected::before,
.patient-exercise-option.selected::after {
  content: none;
  display: none;
}

/* Assignment selections retain their fill and border, but neither the row nor
   the checked control emits a glow. Keyboard focus remains the global outline. */
.patient-exercise-option.selected {
  border-color: rgba(8, 125, 159, 0.34);
  background: rgba(221, 247, 248, 0.74);
  box-shadow: none;
}

input[type="checkbox"][data-patient-exercise-check],
input[type="checkbox"][data-patient-exercise-check]:checked,
input[type="checkbox"][data-patient-exercise-check]:focus {
  box-shadow: none;
}

input[type="checkbox"][data-patient-exercise-check]:focus-visible {
  outline: 3px solid rgba(7, 83, 125, 0.30);
  outline-offset: 2px;
}

/* Patient language and care-team advancement controls */
.patient-portal-hero-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
}

.patient-portal-language-control {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 750;
}

.patient-portal-language-control select {
  width: 126px;
  min-height: 40px;
  padding: 7px 34px 7px 11px;
  border: 1px solid rgba(8, 125, 159, 0.18);
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-inset);
  color: var(--ink-strong);
}

.patient-portal-visual-control select {
  width: 150px;
}

/* Screen-comfort palettes reduce glare with direct, scoped colors. Avoid global
   CSS filters so status meanings, focus rings, artwork, and text remain clear. */
.app-shell[data-role="patient"][data-patient-visual-mode="low-glare"] {
  color-scheme: light;
  --canvas: #dbe4e4;
  --canvas-strong: #d2dddd;
  --surface: #edf1f0;
  --surface-subtle: #e4eae9;
  --surface-muted: #d9e2e1;
  --ink: #29484f;
  --ink-strong: #17343c;
  --ink-soft: #3f5d63;
  --muted: #526b70;
  --muted-light: #657b7f;
  --line: rgba(35, 69, 74, 0.18);
  --line-strong: rgba(35, 69, 74, 0.30);
  --primary: #315f68;
  --primary-hover: #284f57;
  --primary-active: #214249;
  --primary-soft: rgba(49, 95, 104, 0.12);
  --primary-line: rgba(49, 95, 104, 0.30);
  --accent-cyan: #64858a;
  --accent-cyan-soft: #b8cbca;
  --focus: #214d58;
  --glass: rgba(237, 241, 240, 0.92);
  --glass-strong: rgba(242, 244, 243, 0.96);
  --glass-soft: rgba(225, 232, 231, 0.90);
  --glass-line: rgba(35, 69, 74, 0.18);
  --comfort-shell: #dbe4e4;
  --comfort-panel: #e7edec;
  --comfort-panel-strong: #edf1f0;
  --comfort-panel-soft: #e1e8e7;
  --comfort-card: #edf1f0;
  --comfort-chip: #dae5e3;
  --comfort-input: #f2f4f3;
  --comfort-border: rgba(35, 69, 74, 0.20);
  --comfort-decoration: rgba(63, 93, 99, 0.08);
  --comfort-success-bg: #d7e6dd;
  --comfort-success-text: #2d634a;
  --comfort-warning-bg: #e7ded0;
  --comfort-warning-text: #6b4c2d;
  --comfort-note-bg: #e1dce7;
  --comfort-note-text: #5c4967;
  --comfort-danger-bg: #e8d9d7;
  --comfort-danger-text: #773e38;
  --shadow-xs: 0 2px 6px rgba(34, 64, 67, 0.05);
  --shadow-sm: 0 8px 20px rgba(34, 64, 67, 0.08);
  --shadow-md: 0 14px 30px rgba(34, 64, 67, 0.10);
  --shadow-lg: 0 20px 44px rgba(34, 64, 67, 0.13);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  background: var(--comfort-shell);
}

.app-shell[data-role="patient"][data-patient-visual-mode="warm-tint"] {
  color-scheme: light;
  --canvas: #e5dccd;
  --canvas-strong: #dbd0bf;
  --surface: #f2ebdf;
  --surface-subtle: #ebe2d5;
  --surface-muted: #e1d5c4;
  --ink: #473f35;
  --ink-strong: #352f28;
  --ink-soft: #5e5448;
  --muted: #6c6256;
  --muted-light: #7d7367;
  --line: rgba(79, 65, 48, 0.18);
  --line-strong: rgba(79, 65, 48, 0.30);
  --primary: #68523d;
  --primary-hover: #584533;
  --primary-active: #49392b;
  --primary-soft: rgba(104, 82, 61, 0.12);
  --primary-line: rgba(104, 82, 61, 0.31);
  --accent-cyan: #8b7652;
  --accent-cyan-soft: #d6c6a8;
  --focus: #5a4633;
  --glass: rgba(242, 235, 223, 0.92);
  --glass-strong: rgba(247, 241, 231, 0.96);
  --glass-soft: rgba(234, 224, 210, 0.90);
  --glass-line: rgba(79, 65, 48, 0.18);
  --comfort-shell: #e5dccd;
  --comfort-panel: #eee6da;
  --comfort-panel-strong: #f2ebdf;
  --comfort-panel-soft: #e9dfd1;
  --comfort-card: #f2ebdf;
  --comfort-chip: #e1d5c2;
  --comfort-input: #f7f0e5;
  --comfort-border: rgba(79, 65, 48, 0.20);
  --comfort-decoration: rgba(123, 96, 61, 0.09);
  --comfort-success-bg: #dce6d5;
  --comfort-success-text: #405e3d;
  --comfort-warning-bg: #e8dcc7;
  --comfort-warning-text: #6b4c2d;
  --comfort-note-bg: #e4d9df;
  --comfort-note-text: #654b5a;
  --comfort-danger-bg: #ead5d0;
  --comfort-danger-text: #7a4037;
  --shadow-xs: 0 2px 6px rgba(74, 57, 39, 0.05);
  --shadow-sm: 0 8px 20px rgba(74, 57, 39, 0.08);
  --shadow-md: 0 14px 30px rgba(74, 57, 39, 0.10);
  --shadow-lg: 0 20px 44px rgba(74, 57, 39, 0.13);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.44);
  background: var(--comfort-shell);
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] {
  color-scheme: dark;
  --canvas: #11191e;
  --canvas-strong: #172228;
  --surface: #1d2a30;
  --surface-subtle: #243239;
  --surface-muted: #2b3a41;
  --ink: #dae3e1;
  --ink-strong: #f0f4f2;
  --ink-soft: #c1cfcc;
  --muted: #a6b8b5;
  --muted-light: #8fa4a1;
  --line: rgba(214, 232, 228, 0.16);
  --line-strong: rgba(214, 232, 228, 0.28);
  --primary: #326f73;
  --primary-hover: #2b6165;
  --primary-active: #244f53;
  --primary-soft: rgba(103, 179, 181, 0.16);
  --primary-line: rgba(126, 197, 198, 0.38);
  --accent-cyan: #69aeb0;
  --accent-cyan-soft: #365f61;
  --focus: #9fd8d7;
  --success: #86d8af;
  --warning: #f2c28d;
  --danger: #ffafa5;
  --glass: rgba(27, 40, 46, 0.94);
  --glass-strong: rgba(31, 45, 52, 0.97);
  --glass-soft: rgba(34, 49, 56, 0.92);
  --glass-line: rgba(214, 232, 228, 0.16);
  --comfort-shell: #11191e;
  --comfort-panel: #172228;
  --comfort-panel-strong: #1d2a30;
  --comfort-panel-soft: #202e35;
  --comfort-card: #1d2a30;
  --comfort-chip: #293a40;
  --comfort-input: #223239;
  --comfort-border: rgba(214, 232, 228, 0.18);
  --comfort-decoration: rgba(104, 166, 164, 0.10);
  --comfort-success-bg: #1f3d31;
  --comfort-success-text: #86d8af;
  --comfort-warning-bg: #423421;
  --comfort-warning-text: #f2c28d;
  --comfort-note-bg: #342c42;
  --comfort-note-text: #d3bff3;
  --comfort-danger-bg: #472b2b;
  --comfort-danger-text: #ffafa5;
  --shadow-xs: 0 2px 6px rgba(0, 0, 0, 0.20);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.38);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  background: var(--comfort-shell);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) {
  color: var(--ink);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.sidebar, .content-area) {
  border-color: var(--comfort-border);
  background: var(--comfort-panel);
  box-shadow: var(--shadow-md);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.content-header, .header-pill, .sidebar-user, .sidebar-user .secondary-btn, .sidebar-collapse-btn) {
  border-color: var(--comfort-border);
  background: var(--comfort-panel-strong);
  color: var(--ink-soft);
  box-shadow: var(--shadow-xs);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .nav-btn.active {
  border-color: var(--primary-line);
  background: var(--comfort-chip);
  color: var(--primary-active);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.patient-portal-hero, .portal-program-card, .patient-next-appointment-card) {
  border-color: var(--comfort-border);
  background: var(--comfort-panel-strong);
  box-shadow: var(--shadow-sm);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.patient-portal-hero, .sidebar)::before,
.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .sidebar::after {
  display: none;
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.patient-progress-orb, .patient-program-header, .patient-program-footer, .patient-appointment-change-form) {
  border-color: var(--comfort-border);
  background: var(--comfort-panel-soft);
  box-shadow: var(--shadow-inset);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.portal-exercise-card, .experience-intro-card, .experience-results-card, .experience-note-card, .experience-saved-card, .experience-break-card, .experience-custom-placeholder) {
  border-color: var(--comfort-border);
  background: var(--comfort-card);
  box-shadow: var(--shadow-sm);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.patient-program-icon, .portal-exercise-visual, .patient-appointment-calendar-icon, .breathing-header-icon, .experience-intro-art, .experience-note-icon) {
  border-color: var(--comfort-border);
  background: var(--comfort-chip);
  box-shadow: var(--shadow-inset);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.portal-exercise-state, .experience-detail-pills span, .breathing-duration-chip, .experience-how-it-works div, .experience-result-grid > div, .experience-saved-note) {
  border-color: var(--comfort-border);
  background: var(--comfort-chip);
  color: var(--ink-soft);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.patient-portal-language-control select, .patient-appointment-change > summary, .patient-appointment-change-form input, .experience-note-card textarea, .experience-close-btn) {
  border-color: var(--comfort-border);
  background: var(--comfort-input);
  color: var(--ink-strong);
  box-shadow: var(--shadow-inset);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.primary-btn, .success-btn) {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-xs);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.secondary-btn, .soft-btn, .compact-btn, .voice-btn, .voice-done-btn) {
  border-color: var(--comfort-border);
  background: var(--comfort-input);
  color: var(--primary-active);
  box-shadow: var(--shadow-xs);
}

@media (hover: hover) {
  .app-shell[data-role="patient"]:is(
    [data-patient-visual-mode="low-glare"],
    [data-patient-visual-mode="warm-tint"],
    [data-patient-visual-mode="dark-comfort"]
  ) :is(.primary-btn, .success-btn):hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
  }

  .app-shell[data-role="patient"]:is(
    [data-patient-visual-mode="low-glare"],
    [data-patient-visual-mode="warm-tint"],
    [data-patient-visual-mode="dark-comfort"]
  ) :is(.secondary-btn, .soft-btn, .compact-btn, .voice-btn, .voice-done-btn):hover {
    border-color: var(--primary-line);
    background: var(--comfort-chip);
    color: var(--primary-active);
  }
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.patient-experience-dialog, .experience-live-header, .experience-game-stage, .balance-handoff-composite-overlay) {
  border-color: var(--comfort-border);
  background: var(--comfort-panel-strong);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .patient-experience-backdrop {
  background: var(--comfort-shell) !important;
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.portal-exercise-state.active, .patient-appointment-request-status) {
  border-color: var(--comfort-warning-text);
  background: var(--comfort-warning-bg);
  color: var(--comfort-warning-text);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.portal-exercise-state.complete, .patient-appointment-request-status.approved) {
  border-color: var(--comfort-success-text);
  background: var(--comfort-success-bg);
  color: var(--comfort-success-text);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .portal-exercise-state.note {
  border-color: var(--comfort-note-text);
  background: var(--comfort-note-bg);
  color: var(--comfort-note-text);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .patient-appointment-request-status.declined {
  border-color: var(--comfort-danger-text);
  background: var(--comfort-danger-bg);
  color: var(--comfort-danger-text);
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] :is(select, input, textarea, option) {
  color-scheme: dark;
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] :is(.primary-btn, .success-btn) {
  color: #ffffff;
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] .success-btn,
.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] .is-complete .portal-exercise-sequence {
  border-color: #286c4d;
  background: #286c4d;
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] :is(.badge.soft, .portal-exercise-state:not(.active):not(.complete):not(.note)) {
  border-color: var(--comfort-border);
  background: var(--comfort-chip);
  color: var(--ink-soft);
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] .badge.ok {
  border-color: var(--comfort-success-text);
  background: var(--comfort-success-bg);
  color: var(--comfort-success-text);
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] .badge.warn {
  border-color: var(--comfort-warning-text);
  background: var(--comfort-warning-bg);
  color: var(--comfort-warning-text);
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] .badge.danger {
  border-color: var(--comfort-danger-text);
  background: var(--comfort-danger-bg);
  color: var(--comfort-danger-text);
}

.portal-exercise-state.advanced {
  background: rgba(232, 241, 248, 0.92);
  color: #456477;
}

.portal-exercise-card.is-staff-advanced {
  border-color: rgba(69, 100, 119, 0.22);
  background: rgba(246, 250, 252, 0.76);
}

.portal-exercise-card.is-staff-advanced .portal-exercise-sequence {
  background: #607f91;
}

.staff-exercise-monitor.advanced .live-status-dot {
  background: #607f91;
  box-shadow: 0 0 0 4px rgba(96, 127, 145, 0.13);
}

.monitor-advance-btn {
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 7px 10px;
  justify-content: center;
  white-space: normal;
  line-height: 1.25;
}

@media (max-width: 760px) {
  .patient-portal-hero-actions {
    width: 100%;
    justify-content: space-between;
  }

  .patient-portal-language-control select {
    width: min(150px, 43vw);
  }

  .patient-portal-hero-actions {
    flex-wrap: wrap;
  }

  .patient-progress-orb {
    margin-left: auto;
  }
}

/* Contain the decorative sidebar halo on tablet/mobile so it cannot widen the
   document while preserving vertical expansion for the mobile navigation. */
@media (max-width: 1024px) {
  .sidebar {
    overflow-x: clip;
  }
}

/* ========================================================================== */
/* Native-quality motion system                                                */
/* Centralized timings/easing; preserves existing visual design.               */
/* ========================================================================== */
:root {
  --motion-instant: 110ms;
  --motion-fast: 160ms;
  --motion-normal: 230ms;
  --motion-slow: 320ms;
  --motion-page: 390ms;
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Same-origin exercise/game pages can opt into native browser cross-document
   view transitions where supported; unsupported browsers ignore this safely. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: motion-root-out var(--motion-normal) var(--ease-exit) both;
}

::view-transition-new(root) {
  animation: motion-root-in var(--motion-page) var(--ease-enter) both;
}

@keyframes motion-root-out {
  to { opacity: 0.72; transform: translate3d(0, -3px, 0) scale(0.994); }
}

@keyframes motion-root-in {
  from { opacity: 0; transform: translate3d(0, 8px, 0) scale(0.988); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* Primary navigation: one physical selection surface travels between buttons. */
.side-nav {
  position: relative;
  isolation: isolate;
}

.nav-active-indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: var(--motion-nav-width, 0px);
  height: var(--motion-nav-height, 0px);
  border: 1px solid rgba(8, 125, 159, 0.17);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(221, 247, 248, 0.94), rgba(255, 255, 255, 0.76));
  box-shadow:
    7px 8px 18px rgba(5, 60, 96, 0.09),
    -5px -5px 14px rgba(255, 255, 255, 0.84),
    inset 3px 0 0 var(--accent-cyan);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--motion-nav-x, 0px), var(--motion-nav-y, 0px), 0);
  transition:
    transform 300ms var(--ease-standard),
    width 300ms var(--ease-standard),
    height 300ms var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
  will-change: transform;
}

.nav-active-indicator.is-visible { opacity: 1; }
.nav-active-indicator.motion-no-transition { transition: none; }

.side-nav > .nav-btn {
  z-index: 1;
  transform: translateZ(0);
  transition:
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-instant) var(--ease-standard);
}

.side-nav > .nav-btn.active,
.side-nav > .nav-btn.active:hover {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Shared moving selection pill for the compact patient/access tab rails. */
.motion-shared-selection {
  position: relative;
  isolation: isolate;
}

.motion-selection-indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: var(--motion-selection-width, 0px);
  height: var(--motion-selection-height, 0px);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(12, 181, 203, 0.96), rgba(8, 125, 159, 0.98));
  box-shadow:
    0 5px 12px rgba(7, 83, 125, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--motion-selection-x, 0px), var(--motion-selection-y, 0px), 0);
  transition:
    transform 270ms var(--ease-standard),
    width 270ms var(--ease-standard),
    height 270ms var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
  will-change: transform;
}

.motion-selection-indicator.is-visible { opacity: 1; }
.motion-selection-indicator.motion-no-transition { transition: none; }

.motion-shared-selection > .workspace-tab {
  z-index: 1;
  transition:
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-instant) var(--ease-standard);
}

.motion-shared-selection > .workspace-tab.active {
  background: transparent !important;
  box-shadow: none !important;
}

.motion-shared-selection > .workspace-tab.active::after {
  content: none !important;
  display: none !important;
}

/* Modal motion is mounted by JS so legacy modal behavior remains untouched if
   JavaScript motion enhancement is unavailable. */
.modal-backdrop.motion-modal-mounted {
  opacity: 0;
  transition: opacity var(--motion-normal) var(--ease-standard);
}

.modal-backdrop.motion-modal-mounted > .modal-card {
  opacity: 0;
  transform: translate3d(0, 11px, 0) scale(0.96);
  transition:
    transform var(--motion-slow) var(--ease-enter),
    opacity var(--motion-normal) var(--ease-standard);
  will-change: transform, opacity;
}

.modal-backdrop.motion-modal-mounted.motion-modal-open {
  opacity: 1;
}

.modal-backdrop.motion-modal-mounted.motion-modal-open > .modal-card {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.modal-backdrop.motion-modal-closing {
  pointer-events: none;
  opacity: 0;
  transition-duration: var(--motion-fast);
  transition-timing-function: var(--ease-exit);
}

.modal-backdrop.motion-modal-closing > .modal-card {
  opacity: 0;
  transform: translate3d(0, 6px, 0) scale(0.975);
  transition-duration: var(--motion-fast);
  transition-timing-function: var(--ease-exit);
}

/* Menus and popovers stay visually attached to their trigger. */
.history-actions-dropdown {
  opacity: 0;
  transform: translate3d(0, -4px, 0) scale(0.98);
  transition:
    transform 190ms var(--ease-enter),
    opacity var(--motion-fast) var(--ease-standard);
}

.history-actions-dropdown.motion-menu-open {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.history-actions-dropdown.motion-menu-closing {
  opacity: 0;
  transform: translate3d(0, -3px, 0) scale(0.985);
  pointer-events: none;
  transition-duration: 140ms;
  transition-timing-function: var(--ease-exit);
}

/* Consistent physical feedback for interactive controls. */
.primary-btn,
.secondary-btn,
.soft-btn,
.compact-btn,
.success-btn,
.danger-btn,
.warning-btn,
.mobile-menu-btn,
.sidebar-collapse-btn,
.history-actions-trigger,
.workspace-tab,
.patient-rail-item {
  transition:
    transform var(--motion-instant) var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

.primary-btn:active,
.secondary-btn:active,
.soft-btn:active,
.compact-btn:active,
.success-btn:active,
.danger-btn:active,
.warning-btn:active,
.mobile-menu-btn:active,
.sidebar-collapse-btn:active,
.history-actions-trigger:active,
.workspace-tab:active,
.patient-rail-item:active,
.nav-btn:active {
  transform: scale(0.982);
}

@media (hover: hover) and (pointer: fine) {
  .patient-rail-item:hover {
    transform: translate3d(0, -1px, 0);
  }
}

/* Form state changes remain immediate but visually settle instead of snapping. */
input,
select,
textarea {
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}

.switch-slider,
.switch-slider::after {
  transition:
    transform var(--motion-normal) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

/* Existing toast styling, with a subtle scale to connect entry/exit. */
.toast {
  transform: translate3d(0, 12px, 0) scale(0.985);
  transition:
    transform var(--motion-normal) var(--ease-enter),
    opacity var(--motion-fast) var(--ease-standard);
}

.toast.show {
  transform: translate3d(0, 0, 0) scale(1);
}

/* Smaller movement on compact screens. */
@media (max-width: 760px) {
  .nav-active-indicator {
    transition-duration: 240ms, 240ms, 240ms, var(--motion-fast);
  }

  .motion-selection-indicator {
    transition-duration: 230ms, 230ms, 230ms, var(--motion-fast);
  }

  .modal-backdrop.motion-modal-mounted > .modal-card {
    transform: translate3d(0, 7px, 0) scale(0.975);
  }
}

/* Motion accessibility: functionality and state changes never depend on motion. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-instant: 1ms;
    --motion-fast: 1ms;
    --motion-normal: 1ms;
    --motion-slow: 1ms;
    --motion-page: 1ms;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1ms;
  }

  .nav-active-indicator,
  .motion-selection-indicator,
  .modal-backdrop.motion-modal-mounted,
  .modal-backdrop.motion-modal-mounted > .modal-card,
  .history-actions-dropdown,
  .toast,
  .primary-btn,
  .secondary-btn,
  .soft-btn,
  .compact-btn,
  .success-btn,
  .danger-btn,
  .warning-btn,
  .mobile-menu-btn,
  .sidebar-collapse-btn,
  .history-actions-trigger,
  .workspace-tab,
  .patient-rail-item,
  .nav-btn,
  input,
  select,
  textarea,
  .switch-slider,
  .switch-slider::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  .primary-btn:active,
  .secondary-btn:active,
  .soft-btn:active,
  .compact-btn:active,
  .success-btn:active,
  .danger-btn:active,
  .warning-btn:active,
  .mobile-menu-btn:active,
  .sidebar-collapse-btn:active,
  .history-actions-trigger:active,
  .workspace-tab:active,
  .patient-rail-item:active,
  .nav-btn:active,
  .patient-rail-item:hover {
    transform: none;
  }
}

/* ========================================================================== */
/* Sidebar refinement — flat active highlight + smooth desktop collapse       */
/* ========================================================================== */

/* Keep the traveling selection surface, but make it visually plain: no glow,
   no raised shadow and no accent strip on the left edge. */
.nav-active-indicator {
  border-color: rgba(8, 125, 159, 0.16);
  background: rgba(221, 247, 248, 0.94);
  box-shadow: none;
}

@media (min-width: 1025px) {
  /* Animate the actual shell column so the content area follows the sidebar
     continuously instead of jumping between its expanded/collapsed widths. */
  .app-shell {
    grid-template-columns: 238px minmax(0, 1fr);
    transition: grid-template-columns 320ms var(--ease-standard);
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .sidebar {
    transition: padding-inline 320ms var(--ease-standard);
  }

  .sidebar-topbar {
    grid-template-columns: minmax(0, 1fr) 44px;
    transition:
      grid-template-columns 300ms var(--ease-standard),
      gap 300ms var(--ease-standard);
  }

  .sidebar-topbar .sidebar-brand,
  .sidebar .nav-section-label,
  .sidebar .nav-label,
  .sidebar .sidebar-user-copy,
  .sidebar .logout-label {
    display: block;
    overflow: hidden;
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition:
      opacity 170ms var(--ease-standard),
      transform 260ms var(--ease-standard),
      max-width 300ms var(--ease-standard),
      max-height 260ms var(--ease-standard),
      padding 260ms var(--ease-standard),
      margin 260ms var(--ease-standard);
  }

  .sidebar-topbar .sidebar-brand {
    display: flex;
    max-width: 180px;
    white-space: nowrap;
  }

  .sidebar .nav-section-label {
    max-width: 180px;
    max-height: 30px;
  }

  .sidebar .nav-label,
  .sidebar .logout-label {
    max-width: 150px;
    white-space: nowrap;
  }

  .sidebar .sidebar-user-copy {
    max-width: 150px;
    white-space: nowrap;
  }

  .side-nav > .nav-btn {
    justify-content: flex-start;
    transition:
      color var(--motion-fast) var(--ease-standard),
      background-color var(--motion-fast) var(--ease-standard),
      border-color var(--motion-fast) var(--ease-standard),
      transform var(--motion-instant) var(--ease-standard),
      padding-inline 300ms var(--ease-standard),
      gap 260ms var(--ease-standard);
  }

  .sidebar-user {
    transition:
      padding 300ms var(--ease-standard),
      gap 300ms var(--ease-standard),
      grid-template-columns 300ms var(--ease-standard);
  }

  .sidebar-user .secondary-btn {
    transition:
      transform var(--motion-instant) var(--ease-standard),
      opacity var(--motion-fast) var(--ease-standard),
      color var(--motion-fast) var(--ease-standard),
      background-color var(--motion-fast) var(--ease-standard),
      border-color var(--motion-fast) var(--ease-standard),
      box-shadow var(--motion-fast) var(--ease-standard),
      padding-inline 300ms var(--ease-standard),
      gap 260ms var(--ease-standard);
  }

  .sidebar-collapse-btn svg {
    transition: transform 300ms var(--ease-standard);
  }

  .sidebar.is-collapsed {
    padding-inline: 12px;
  }

  .sidebar.is-collapsed .sidebar-topbar {
    display: grid;
    grid-template-columns: 0px 44px;
    gap: 8px;
    justify-content: stretch;
  }

  .sidebar.is-collapsed .sidebar-topbar .sidebar-brand,
  .sidebar.is-collapsed .nav-section-label,
  .sidebar.is-collapsed .nav-label,
  .sidebar.is-collapsed .sidebar-user-copy,
  .sidebar.is-collapsed .logout-label {
    display: block;
    max-width: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    transform: translate3d(-6px, 0, 0);
    pointer-events: none;
  }

  .sidebar.is-collapsed .sidebar-topbar .sidebar-brand {
    display: flex;
  }

  .sidebar.is-collapsed .nav-btn {
    justify-content: flex-start;
    gap: 0;
    padding-inline: 20px;
  }

  .sidebar.is-collapsed .nav-btn.active {
    box-shadow: none;
  }

  .sidebar.is-collapsed .sidebar-user {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .sidebar.is-collapsed .sidebar-user::before {
    justify-self: center;
  }

  .sidebar.is-collapsed .sidebar-user .secondary-btn {
    width: 44px;
    min-width: 44px;
    justify-self: center;
    padding-inline: 0;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .sidebar,
  .sidebar-topbar,
  .sidebar-topbar .sidebar-brand,
  .sidebar .nav-section-label,
  .sidebar .nav-label,
  .sidebar .sidebar-user-copy,
  .sidebar .logout-label,
  .sidebar-user,
  .sidebar-user .secondary-btn,
  .sidebar-collapse-btn svg {
    transition-duration: 1ms !important;
  }
}


/* ========================================================================== */
/* Requested sidebar, Access Control, patient-list, and checkbox refinements  */
/* ========================================================================== */

/* Restore enough expanded sidebar width for the complete site name while
   preserving the smooth collapse animation introduced in the motion pass. */
@media (min-width: 1025px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .sidebar-topbar .sidebar-brand {
    max-width: none;
    min-width: 0;
    overflow: visible;
  }

  .sidebar-brand-copy strong {
    display: block;
    white-space: normal;
    line-height: 1.15;
  }

  .sidebar.is-collapsed .sidebar-topbar .sidebar-brand {
    max-width: 0;
    overflow: hidden;
  }
}

/* Checked checkboxes stay flat. Keyboard focus remains visible through the
   site's outline treatment, but no checkbox receives a glow/ring shadow. */
input[type="checkbox"],
input[type="checkbox"]:checked,
input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible {
  box-shadow: none !important;
}

/* Limit the patient rail to approximately ten patient rows and make the
   remainder reachable by scrolling without lengthening the whole page. */
.patient-rail-list {
  max-height: 694px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Access Control: Registered Exercises tab icon reuses the existing exercise
   icon language instead of introducing a new visual asset. */
.access-tab-icon-exercises {
  -webkit-mask-image: var(--icon-note);
  mask-image: var(--icon-note);
}

.account-directory-filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) auto minmax(165px, .9fr) minmax(145px, .75fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.account-directory-filters .form-field {
  margin: 0;
}

.account-search-btn {
  min-height: 44px;
}

.account-filter-clear {
  align-self: center;
  white-space: nowrap;
}

.account-results-summary {
  margin-top: -6px;
  color: var(--muted);
  font-size: .82rem;
}

.registered-exercises-layout {
  display: grid;
  gap: 18px;
}

.registered-exercises-heading {
  margin: 0;
}

.registered-exercise-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.registered-exercise-form .form-field {
  margin: 0;
}

.registered-exercise-note-toggle {
  min-height: 44px;
  margin: 0;
}

.registered-exercise-submit {
  min-height: 44px;
  white-space: nowrap;
}

.registered-exercise-list {
  display: grid;
  gap: 10px;
}

@media (max-width: 900px) {
  .account-directory-filters {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .account-directory-filters .form-field:not(.account-name-filter) {
    grid-column: span 1;
  }

  .account-filter-clear {
    justify-self: start;
  }

  .registered-exercise-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .account-directory-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-search-btn,
  .registered-exercise-submit {
    width: 100%;
  }

  .patient-rail-list {
    max-height: 694px;
  }
}

/* ========================================================================== */
/* Dropdown, mobile navigation, and patient-selection refinements             */
/* ========================================================================== */

/* Keep account filter actions visually consistent with the site's compact
   secondary controls rather than using an unframed text-only action. */
.account-filter-clear {
  min-height: 44px;
  padding-inline: 14px;
  border-radius: var(--radius-md);
  color: var(--primary-active);
  font-weight: 700;
}

/* Give standard single-choice selects one consistent portal treatment while
   retaining the browser's native accessible option list behavior. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  padding-right: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8' fill='none'%3E%3Cpath d='M2 1.5 7 6.5l5-5' stroke='%2307537d' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 8px;
  color: var(--ink-strong);
  box-shadow: none;
  cursor: pointer;
}

select:not([multiple]):not([size]):hover:not(:disabled) {
  border-color: var(--primary-line);
  background-color: var(--surface-subtle);
}

select:not([multiple]):not([size]):focus,
select:not([multiple]):not([size]):focus-visible {
  border-color: var(--focus);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(7, 83, 125, 0.12);
}

select:not([multiple]):not([size]):disabled {
  cursor: not-allowed;
  opacity: 0.62;
  background-color: var(--surface-muted);
}

select option {
  background: var(--surface);
  color: var(--ink-strong);
}

/* Patient directory uses one shared physical selection surface, matching the
   sidebar's moving-highlight behavior instead of swapping row backgrounds. */
.patient-rail-list.motion-patient-selection {
  position: relative;
  isolation: isolate;
}

.patient-active-indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: var(--motion-patient-width, 0px);
  height: var(--motion-patient-height, 0px);
  border: 1px solid rgba(8, 125, 159, 0.16);
  border-radius: 10px;
  background: rgba(221, 247, 248, 0.94);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--motion-patient-x, 0px), var(--motion-patient-y, 0px), 0);
  transition:
    transform 300ms var(--ease-standard),
    width 300ms var(--ease-standard),
    height 300ms var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
  will-change: transform;
}

.patient-active-indicator.is-visible {
  opacity: 1;
}

.patient-active-indicator.motion-no-transition {
  transition: none;
}

.patient-rail-list.motion-patient-selection > .patient-rail-item {
  position: relative;
  z-index: 1;
}

.patient-rail-list.motion-patient-selection > .patient-rail-item.selected,
.patient-rail-list.motion-patient-selection > .patient-rail-item.selected:hover {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

/* Mobile/small-screen sidebar remains mounted so both opening and closing can
   animate; no display:none snap occurs when the hamburger is toggled. */
@media (max-width: 1024px) {
  .sidebar .side-nav {
    display: grid;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, -8px, 0) scale(0.995);
    transform-origin: top center;
    transition:
      max-height 320ms var(--ease-standard),
      padding-top 280ms var(--ease-standard),
      padding-bottom 280ms var(--ease-standard),
      opacity 170ms var(--ease-standard),
      transform 280ms var(--ease-standard),
      visibility 0s linear 320ms;
  }

  .sidebar .sidebar-user {
    display: grid;
    max-height: 0;
    min-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, -6px, 0);
    transition:
      max-height 300ms var(--ease-standard),
      margin-top 280ms var(--ease-standard),
      padding-top 280ms var(--ease-standard),
      padding-bottom 280ms var(--ease-standard),
      opacity 160ms var(--ease-standard),
      transform 260ms var(--ease-standard),
      visibility 0s linear 300ms;
  }

  .sidebar.mobile-nav-open .side-nav {
    max-height: 520px;
    padding-top: 14px;
    padding-bottom: 4px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    transition-delay: 0s;
  }

  .sidebar.mobile-nav-open .sidebar-user {
    max-height: 150px;
    margin-top: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    transition-delay: 0s;
  }
}

@media (max-width: 760px) {
  .patient-active-indicator {
    transition-duration: 240ms, 240ms, 240ms, var(--motion-fast);
  }
}

@media (prefers-reduced-motion: reduce) {
  .patient-active-indicator,
  .sidebar .side-nav,
  .sidebar .sidebar-user {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

/* ========================================================================== */
/* Requested compact UI cleanup                                               */
/* ========================================================================== */

/* Align Clear filters with the bottoms of the other account-filter controls. */
.account-directory-filters .account-filter-clear {
  align-self: end;
  min-height: 44px;
  margin: 0;
}

/* Notes and Provider's Note tabs no longer repeat their tab names inside a
   highlighted intro block. Keep only their useful controls/count in a plain row. */
.patient-panel-actions-only {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.patient-panel-actions-only.provider-notes-intro {
  justify-content: flex-end;
}

/* History row actions should read as the ellipsis itself, not as a card/button. */
.history-actions-trigger,
.history-actions-trigger:hover,
.history-actions-trigger[aria-expanded="true"],
.history-actions-trigger:active {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  appearance: none;
}

.history-actions-trigger:hover,
.history-actions-trigger[aria-expanded="true"] {
  color: var(--primary-active);
}

.history-actions-trigger:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: none;
}

/* ========================================================================== */
/* Patient actions, results, compact counters, and collapsed-sidebar fixes    */
/* ========================================================================== */

/* The Notes and Provider's Note counters stay useful without reserving a tall
   header row. */
.patient-panel-actions-only,
.patient-panel-actions-only.provider-notes-intro {
  min-height: 0;
  margin-bottom: 10px;
  line-height: 1;
}

.patient-panel-actions-only > .badge,
.provider-notes-heading-actions > .badge {
  min-height: 22px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  line-height: 1.15;
}

.provider-notes-heading-actions {
  align-items: center;
  gap: 8px;
}

/* Patient header actions are consolidated into one quiet ellipsis menu. */
.patient-record-actions-menu {
  position: relative;
  display: inline-block;
}

.patient-record-actions-menu > summary {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  cursor: pointer;
  list-style: none;
  appearance: none;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  transition: color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard);
}

.patient-record-actions-menu > summary::-webkit-details-marker { display: none; }

.patient-record-actions-menu > summary:hover,
.patient-record-actions-menu[open] > summary {
  background: var(--surface-muted);
  color: var(--primary-active);
}

.patient-record-actions-menu > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.patient-record-actions-dropdown {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 210px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.patient-record-actions-dropdown button {
  width: 100%;
  min-height: 38px;
  display: block;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 750;
  cursor: pointer;
}

.patient-record-actions-dropdown button:hover,
.patient-record-actions-dropdown button:focus-visible {
  background: var(--surface-muted);
  color: var(--ink-strong);
}

.patient-record-actions-dropdown .danger-menu-action {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--danger);
}

.patient-record-actions-dropdown .danger-menu-action:hover,
.patient-record-actions-dropdown .danger-menu-action:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Exercise Results reuses the same compact patient tab rail and groups each
   exercise into a collapsible, low-shadow result list. */
.tab-icon-results {
  -webkit-mask-image: var(--icon-list-check);
  mask-image: var(--icon-list-check);
}

.patient-exercise-results-panel {
  display: grid;
  gap: 10px;
}

.exercise-results-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 0;
}

.exercise-results-summary-row .badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  line-height: 1.15;
}

.exercise-results-pdf-btn {
  min-height: 38px;
  gap: 8px;
  padding: 8px 13px;
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  background: var(--surface);
  color: var(--primary-active);
  white-space: nowrap;
}

.exercise-results-pdf-icon {
  position: relative;
  width: 15px;
  height: 18px;
  flex: 0 0 15px;
  border: 1.7px solid currentColor;
  border-radius: 2px;
}

.exercise-results-pdf-icon::before {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  border-left: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  background: var(--surface);
}

.exercise-results-pdf-icon::after {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 7px;
  height: 2px;
  border-top: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.exercise-pdf-modal-backdrop {
  padding: clamp(14px, 4vw, 36px);
}

.exercise-pdf-modal {
  width: min(680px, 100%);
  max-height: min(760px, calc(100dvh - 28px));
}

.exercise-pdf-modal-header {
  align-items: flex-start;
}

.exercise-pdf-modal-header .eyebrow,
.exercise-pdf-modal-header h2,
.exercise-pdf-modal-header p {
  margin-bottom: 4px;
}

.exercise-pdf-modal-body {
  display: grid;
  gap: 11px;
  overflow-y: auto;
}

.exercise-pdf-option {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 86px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink-strong);
  box-shadow: none;
  text-align: left;
  transition: border-color var(--motion-fast) var(--ease-standard), background-color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
}

.exercise-pdf-option:hover,
.exercise-pdf-option:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 46%, var(--line));
  background: var(--primary-soft);
}

.exercise-pdf-option:hover {
  transform: translateY(-1px);
}

.exercise-pdf-option:disabled {
  cursor: wait;
  opacity: 0.62;
}

.exercise-pdf-option.is-generating {
  border-color: var(--primary);
  background: var(--primary-soft);
  opacity: 1;
}

.exercise-pdf-option > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.exercise-pdf-option strong {
  font-size: 0.91rem;
}

.exercise-pdf-option small {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.exercise-pdf-option-arrow {
  color: var(--primary-active);
  font-size: 1.12rem;
}

.exercise-pdf-option-icon {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-active);
}

.exercise-pdf-option-icon-graphs::before {
  content: '';
  width: 23px;
  height: 18px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: linear-gradient(145deg, transparent 42%, currentColor 43% 48%, transparent 49%);
}

.exercise-pdf-option-icon-results::before,
.exercise-pdf-option-icon-combined::before {
  content: '';
  width: 21px;
  height: 25px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: repeating-linear-gradient(to bottom, transparent 0 5px, currentColor 5px 6.5px);
}

.exercise-pdf-option-icon-combined::after {
  content: '';
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 13px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: var(--primary-soft) linear-gradient(145deg, transparent 42%, currentColor 43% 50%, transparent 51%);
}

.exercise-result-groups {
  display: grid;
  gap: 8px;
}

.exercise-result-group-wrap {
  position: relative;
  min-width: 0;
}

.exercise-result-group-wrap:has(.exercise-result-graph-btn) .exercise-result-group > summary {
  padding-right: 148px;
}

.exercise-result-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: none;
}

.exercise-result-group > summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
  color: var(--ink-strong);
  transition: background-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.exercise-result-group > summary::-webkit-details-marker { display: none; }
.exercise-result-group > summary:hover { background: var(--surface-muted); }
.exercise-result-group > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.exercise-result-group-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-active);
}

.exercise-result-group-icon svg { width: 21px; height: 21px; }

.exercise-result-group-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.exercise-result-group-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

.exercise-result-group-copy small {
  color: var(--muted);
  font-size: 0.69rem;
}

.exercise-result-group-chevron {
  width: 9px;
  height: 9px;
  justify-self: end;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.exercise-result-group[open] .exercise-result-group-chevron {
  color: var(--primary-active);
  transform: rotate(225deg) translate(-1px, -1px);
}

.exercise-result-entry-list {
  border-top: 1px solid var(--line);
}

.exercise-result-entry {
  padding: 12px;
  background: var(--surface);
}

.exercise-result-entry + .exercise-result-entry { border-top: 1px solid var(--line); }

.exercise-result-graph-btn {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 36px;
  min-height: 32px;
  gap: 6px;
  padding: 6px 9px;
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  background: var(--surface);
  color: var(--primary-active);
  font-size: 0.69rem;
  white-space: nowrap;
}

.exercise-result-graph-btn:hover {
  background: var(--primary-soft);
}

.exercise-result-graph-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}

.exercise-result-graph-icon::before,
.exercise-result-graph-icon::after {
  content: '';
  width: 3px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.exercise-result-graph-icon::before {
  height: 7px;
  box-shadow: 5px -4px 0 currentColor;
}

.exercise-result-graph-icon::after { height: 12px; }

.exercise-result-entry-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.exercise-result-entry-metrics > div,
.exercise-result-detail-grid > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.exercise-result-entry-metrics span,
.exercise-result-detail-grid dt,
.exercise-result-note > span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

.exercise-result-entry-metrics strong,
.exercise-result-detail-grid dd {
  margin: 0;
  color: var(--ink-strong);
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.exercise-result-specific-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
}

.exercise-result-specific-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle, var(--surface-muted));
}

.exercise-result-specific-grid dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.exercise-result-specific-grid dd {
  margin: 0;
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.exercise-graph-modal-backdrop {
  padding: clamp(12px, 3vw, 32px);
}

.exercise-graph-modal {
  width: min(940px, 100%);
  max-height: min(860px, calc(100dvh - 32px));
}

.exercise-graph-modal-header {
  align-items: flex-start;
}

.exercise-graph-modal-header .eyebrow,
.exercise-graph-modal-header h2,
.exercise-graph-modal-header p {
  margin-bottom: 4px;
}

.exercise-graph-modal-body {
  display: grid;
  gap: 16px;
  overflow: auto;
}

.exercise-graph-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.exercise-progress-graph {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
  color: var(--ink-soft);
}

.exercise-graph-y-tick line {
  stroke: var(--line);
  stroke-width: 1;
}

.exercise-graph-y-tick text,
.exercise-graph-x-tick text {
  fill: var(--muted);
  font: 600 12px/1 system-ui, sans-serif;
}

.exercise-graph-x-tick line,
.exercise-graph-axis {
  stroke: var(--ink-soft);
  stroke-width: 1.5;
}

.exercise-graph-line {
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.exercise-graph-point {
  fill: var(--surface);
  stroke: var(--primary-active);
  stroke-width: 3;
}

.exercise-graph-axis-label {
  fill: var(--ink-strong);
  font: 700 13px/1 system-ui, sans-serif;
}

.exercise-graph-data-table-wrap {
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.exercise-graph-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.exercise-graph-data-table th,
.exercise-graph-data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.exercise-graph-data-table th {
  position: sticky;
  top: 0;
  background: var(--surface-muted);
  color: var(--ink-strong);
}

.exercise-graph-data-table tr:last-child td { border-bottom: 0; }

.exercise-graph-empty {
  padding: 36px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  text-align: center;
}

.exercise-graph-empty p {
  margin: 6px 0 0;
  color: var(--muted);
}

.experience-results-card-detailed {
  width: min(820px, 100%);
}

.experience-result-exercise-name {
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 700;
}

.experience-result-specific-grid {
  margin: 20px 0 26px;
  text-align: left;
}

.exercise-result-summary,
.exercise-result-note p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.5;
}

.exercise-result-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 12px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.exercise-result-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* Accounts table ellipsis should be the dots themselves, not another card. */
.account-actions-menu > summary,
.account-actions-menu > summary:hover,
.account-actions-menu[open] > summary,
.account-actions-menu > summary:active {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  appearance: none;
}

.account-actions-menu > summary:hover,
.account-actions-menu[open] > summary {
  color: var(--primary-active);
}

.account-actions-menu > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: none;
}

/* Center the icon surface exactly within the 84px collapsed sidebar. */
@media (min-width: 1025px) {
  .sidebar.is-collapsed .side-nav > .nav-btn {
    justify-content: center;
    gap: 0;
    padding-inline: 0;
  }

  .sidebar.is-collapsed .side-nav > .nav-btn::before {
    margin-inline: auto;
  }
}

@media (max-width: 680px) {
  .exercise-results-summary-row {
    align-items: stretch;
  }

  .exercise-results-summary-row .badge {
    align-self: center;
  }

  .exercise-results-pdf-btn {
    min-height: 42px;
  }

  .exercise-pdf-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .exercise-pdf-modal {
    width: 100%;
    max-height: min(92dvh, 760px);
    border-radius: 22px 22px 0 0;
  }

  .exercise-pdf-modal-body {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .exercise-pdf-option {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 82px;
    padding: 12px;
  }

  .exercise-pdf-option-icon {
    width: 44px;
    height: 44px;
  }

  .patient-record-actions-dropdown {
    right: 0;
    max-width: min(240px, calc(100vw - 32px));
  }

  .exercise-result-entry-metrics,
  .exercise-result-detail-grid,
  .exercise-result-specific-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .exercise-result-group-wrap:has(.exercise-result-graph-btn) .exercise-result-group > summary {
    padding-right: 92px;
  }

  .exercise-result-graph-btn {
    right: 33px;
    width: 38px;
    padding-inline: 10px;
    overflow: hidden;
    color: transparent;
  }

  .exercise-result-graph-btn .exercise-result-graph-icon {
    flex: 0 0 14px;
    color: var(--primary-active);
  }

  .exercise-graph-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .exercise-graph-modal {
    width: 100%;
    max-height: min(92dvh, 860px);
    border-radius: 22px 22px 0 0;
  }
}

@media (max-width: 420px) {
  .exercise-results-summary-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .exercise-results-summary-row .badge {
    justify-self: start;
  }

  .exercise-results-pdf-btn {
    width: 100%;
    justify-content: center;
  }

  .exercise-pdf-option {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .exercise-pdf-option-icon {
    width: 40px;
    height: 40px;
  }

  .exercise-result-entry-metrics,
  .exercise-result-detail-grid,
  .exercise-result-specific-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .exercise-result-group-copy strong {
    max-width: 155px;
  }
}


/* Notes/Provider's Note counters sit directly beneath the patient tab rail. */
.patient-tab-panel.patient-tab-panel-compact-top {
  padding-top: 8px;
}

@media (max-width: 640px) {
  .patient-tab-panel.patient-tab-panel-compact-top {
    padding-top: 6px;
  }
}

/* ========================================================================== */
/* Full-space page consistency and daily Patient Assignment                   */
/* ========================================================================== */

/* Keep every workspace on the same full content plane. The ID selector wins
   over older page-specific width caps without changing the site's design. */
.content-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#mainContent.main-content {
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  grid-auto-columns: minmax(0, 1fr);
  align-self: stretch;
}

#mainContent.main-content > * {
  width: 100%;
  max-width: none;
}

#mainContent[data-view="patients"] .patient-directory-layout {
  min-height: 100%;
  align-items: stretch;
}

#mainContent[data-view="patients"] :is(.patient-list-pane, .patient-detail-pane),
#mainContent[data-view="access"] .access-control-shell,
#mainContent[data-view="history"] .history-card {
  width: 100%;
}

/* Preserve the compact separation between each page header/count surface and
   its tab rail. */
.patient-detail-pane > .workspace-tabs,
.access-control-shell > .access-tabs {
  margin-inline: 8px;
}

/* History categories use one quiet solid highlight across the entire header. */
.history-table thead th {
  background: var(--surface-subtle);
  background-image: none;
}

#mainContent[data-view="patientAssignment"] {
  align-content: start;
}

.daily-patient-assignment-card {
  padding: 0;
  overflow: hidden;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.daily-patient-assignment-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.daily-patient-assignment-heading > div {
  min-width: 0;
}

.daily-patient-assignment-heading .eyebrow {
  margin-bottom: 3px;
}

.daily-patient-assignment-heading h2 {
  margin: 0;
  font-size: 1.12rem;
}

.daily-patient-assignment-heading p:last-child {
  max-width: 720px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.daily-patient-assignment-heading > .badge {
  flex: 0 0 auto;
}

.daily-patient-assignment-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(190px, 0.7fr) auto;
  gap: 16px;
  align-items: start;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.daily-patient-assignment-toolbar .form-field {
  min-width: 0;
  margin: 0;
}

.daily-patient-assignment-toolbar :is(input, .display-date-picker) {
  width: 100%;
}

.daily-patient-assignment-toolbar .form-field > small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.7rem;
}

.daily-assignment-save-btn {
  min-width: 172px;
  min-height: 44px;
  width: 100%;
  margin: 0;
}

.daily-assignment-action-field {
  min-width: 172px;
  align-self: start;
}

.daily-assignment-action-label {
  visibility: hidden;
  white-space: nowrap;
}

.daily-assignment-prerequisite,
.daily-assignment-empty-state {
  margin: 20px 22px;
}

.daily-assignment-empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
}

.daily-patient-assignment-table-wrap {
  margin: 20px 22px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  scrollbar-gutter: stable;
}

.daily-patient-assignment-table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.daily-assignment-number-col { width: 58px; }
.daily-assignment-patient-col { width: 24%; }
.daily-assignment-time-col { width: 130px; }
.daily-assignment-staff-col { width: 27%; }
.daily-assignment-visit-col { width: 180px; }
.daily-assignment-action-col { width: 88px; }

.daily-patient-assignment-table thead th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-muted);
  background-image: none;
  color: var(--ink-soft);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
}

.daily-patient-assignment-table thead th:first-child,
.daily-patient-assignment-table tbody th {
  text-align: center;
}

.daily-patient-assignment-table tbody :is(th, td) {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  vertical-align: middle;
}

.daily-patient-assignment-table tbody tr:nth-child(even) :is(th, td) {
  background: #f8fcfd;
}

.daily-patient-assignment-table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

.daily-patient-assignment-table tbody tr:hover :is(th, td) {
  background: var(--surface-subtle);
}

.daily-patient-assignment-table :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  background-color: var(--surface);
  box-shadow: none;
}

.daily-patient-assignment-table .assigned-patient-number {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--primary-line);
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: none;
}

.patient-assignment-combobox {
  position: relative;
  min-width: 0;
}

.patient-assignment-combobox input {
  padding-right: 38px;
}

.patient-assignment-combobox-chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--primary-active);
  border-bottom: 2px solid var(--primary-active);
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.patient-assignment-combobox-menu {
  position: fixed;
  z-index: 6000;
  max-height: min(320px, 52vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.patient-assignment-combobox-option {
  width: 100%;
  min-height: 50px;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  text-align: left;
}

.patient-assignment-combobox-option + .patient-assignment-combobox-option {
  margin-top: 2px;
}

.patient-assignment-combobox-option:hover,
.patient-assignment-combobox-option.active {
  background: var(--surface-subtle);
  color: var(--ink-strong);
}

.patient-assignment-combobox-option strong,
.patient-assignment-combobox-option small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-assignment-combobox-option strong {
  font-size: 0.79rem;
}

.patient-assignment-combobox-option small {
  color: var(--muted);
  font-size: 0.68rem;
}

.patient-assignment-combobox-empty {
  padding: 16px 12px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.daily-assignment-delete-cell {
  text-align: right;
}

.daily-assignment-delete-btn {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  font-size: 0.74rem;
}

.daily-assignment-table-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  padding: 13px 22px 18px;
  color: var(--muted);
  font-size: 0.74rem;
}

.daily-assignment-table-summary strong {
  color: var(--primary-active);
}

.assignment-readonly-notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .daily-patient-assignment-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.7fr);
  }

  .daily-assignment-action-field {
    grid-column: 1 / -1;
  }

  .daily-assignment-action-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .daily-patient-assignment-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 17px 16px;
  }

  .daily-patient-assignment-toolbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .daily-assignment-action-field {
    grid-column: auto;
  }

  .daily-assignment-prerequisite,
  .daily-assignment-empty-state,
  .daily-patient-assignment-table-wrap {
    margin-inline: 16px;
  }

  .daily-patient-assignment-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .daily-patient-assignment-table,
  .daily-patient-assignment-table tbody,
  .daily-patient-assignment-table tr,
  .daily-patient-assignment-table :is(th, td) {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .daily-patient-assignment-table colgroup,
  .daily-patient-assignment-table thead {
    display: none;
  }

  .daily-patient-assignment-table tbody {
    display: grid;
    gap: 12px;
  }

  .daily-patient-assignment-table tbody tr {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
  }

  .daily-patient-assignment-table tbody :is(th, td),
  .daily-patient-assignment-table tbody tr:nth-child(even) :is(th, td),
  .daily-patient-assignment-table tbody tr:hover :is(th, td) {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .daily-patient-assignment-table tbody th {
    grid-row: 1 / span 5;
  }

  .daily-patient-assignment-table tbody td {
    grid-column: 2;
  }

  .daily-patient-assignment-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .daily-assignment-delete-cell {
    margin-top: 2px;
  }

  .daily-assignment-delete-btn {
    width: auto;
    min-width: 94px;
  }

  .daily-assignment-table-summary {
    padding-inline: 16px;
  }
}

/* 2026-08-10 mobile top-bar vertical alignment refinement. The collapsed
   navigation rows remain mounted for animation, so remove their closed-state
   row gaps from the visible top bar instead of changing any navigation logic. */
@media (max-width: 768px) {
  .sidebar {
    min-height: 60px;
    row-gap: 0;
    column-gap: 10px;
    padding: 11px 18px 5px;
  }
}

/* Per-exercise breathing duration fields in staff assignment workflows. */
.exercise-row:not(.readonly-exercise-row),
.exercise-row:not(.readonly-exercise-row):has(> .staff-exercise-monitor) {
  grid-template-columns:
    minmax(108px, 0.48fr)
    minmax(190px, 1fr)
    minmax(128px, 0.56fr)
    minmax(220px, 1.2fr);
  align-items: start;
}

.exercise-row > :is(.duration-field, .exercise-select-field, .breathing-duration-field, .note-review-field),
.patient-exercise-option > :is(.patient-exercise-duration-field, .patient-exercise-breathing-duration-field, .patient-exercise-choice) {
  min-width: 0;
}

.breathing-duration-field select,
.patient-exercise-breathing-duration-field select {
  width: 100%;
  min-width: 0;
}

.breathing-duration-field label,
.patient-exercise-breathing-duration-field label {
  white-space: nowrap;
}

.exercise-row:has(> .staff-exercise-monitor) > .staff-exercise-monitor {
  width: 100%;
  grid-column: 1 / -1;
}

.exercise-row.readonly-exercise-row,
.exercise-row.readonly-exercise-row:has(> .staff-exercise-monitor) {
  grid-template-columns: minmax(410px, 1.15fr) minmax(260px, 0.85fr);
  align-items: start;
}

.readonly-exercise-row > .readonly-exercise-summary {
  grid-template-columns: minmax(88px, 0.42fr) minmax(170px, 1fr) minmax(116px, 0.55fr);
}

.readonly-exercise-row > .note-review-field {
  grid-column: auto;
}

/* Compliance Patient List: sequence, exercise time, breathing time, exercise. */
.patient-exercise-option {
  grid-template-columns: 54px minmax(116px, 0.34fr) minmax(116px, 0.32fr) minmax(180px, 1fr);
  grid-template-areas: "sequence time breathing exercise";
  align-items: end;
  gap: 8px;
}

.patient-exercise-option > .patient-exercise-sequence-field { grid-area: sequence; }
.patient-exercise-option > .patient-exercise-duration-field { grid-area: time; }
.patient-exercise-option > .patient-exercise-breathing-duration-field { grid-area: breathing; }
.patient-exercise-option > .patient-exercise-choice { grid-area: exercise; }

.patient-exercise-breathing-duration-field {
  gap: 4px;
}

.patient-exercise-breathing-duration-field label {
  font-size: 0.7rem;
}

/* Current-plan rows retain both timing values without crowding the exercise. */
.current-exercise-item {
  grid-template-columns: 32px minmax(88px, auto) minmax(0, 1fr) minmax(118px, auto);
  grid-template-areas: "sequence duration name breathing";
}

.current-exercise-item > .current-exercise-sequence { grid-area: sequence; }
.current-exercise-item > .current-exercise-duration { grid-area: duration; }
.current-exercise-item > :nth-child(3) {
  min-width: 0;
  grid-area: name;
  overflow-wrap: anywhere;
}

.current-exercise-breathing {
  min-height: 32px;
  display: inline-flex;
  grid-area: breathing;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .exercise-row:not(.readonly-exercise-row),
  .exercise-row:not(.readonly-exercise-row):has(> .staff-exercise-monitor) {
    grid-template-columns: minmax(104px, 0.48fr) minmax(180px, 1fr) minmax(124px, 0.56fr);
  }

  .exercise-row:not(.readonly-exercise-row) > .note-review-field {
    grid-column: 1 / -1;
  }

  .exercise-row.readonly-exercise-row,
  .exercise-row.readonly-exercise-row:has(> .staff-exercise-monitor) {
    grid-template-columns: minmax(390px, 1.1fr) minmax(250px, 0.9fr);
  }
}

@media (max-width: 768px) {
  .exercise-row:not(.readonly-exercise-row),
  .exercise-row:not(.readonly-exercise-row):has(> .staff-exercise-monitor),
  .exercise-row.readonly-exercise-row,
  .exercise-row.readonly-exercise-row:has(> .staff-exercise-monitor) {
    grid-template-columns: minmax(0, 1fr);
  }

  .exercise-row:not(.readonly-exercise-row) > .note-review-field,
  .readonly-exercise-row > .note-review-field {
    grid-column: auto;
  }

  .readonly-exercise-row > .readonly-exercise-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .patient-exercise-option {
    grid-template-columns: 54px minmax(0, 1fr) minmax(118px, 0.45fr);
    grid-template-areas:
      "sequence exercise exercise"
      "time time breathing";
    align-items: end;
  }

  .current-exercise-item {
    grid-template-columns: 30px minmax(82px, auto) minmax(0, 1fr);
    grid-template-areas:
      "sequence duration name"
      "sequence breathing breathing";
    gap: 7px;
  }

  .current-exercise-breathing {
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .readonly-exercise-row > .readonly-exercise-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .patient-exercise-option {
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
      "sequence exercise"
      "time time"
      "breathing breathing";
  }

  .current-exercise-item {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas:
      "sequence name"
      "duration duration"
      "breathing breathing";
  }

  .current-exercise-duration,
  .current-exercise-breathing {
    justify-self: start;
  }
}

/* Verified appointments and patient-submitted change requests. */
.patient-next-appointment-card,
.care-team-appointment-panel {
  min-width: 0;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(242, 253, 254, 0.9), rgba(255, 255, 255, 0.76));
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.patient-next-appointment-card {
  padding: clamp(20px, 2.8vw, 28px);
}

.patient-next-appointment-summary,
.care-team-appointment-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.patient-next-appointment-summary > div,
.care-team-appointment-heading > div,
.care-team-appointment-request > div {
  min-width: 0;
}

.patient-appointment-calendar-icon {
  position: relative;
  display: grid;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(8, 125, 159, 0.18);
  border-radius: 16px;
  background: rgba(221, 247, 248, 0.86);
  box-shadow: var(--shadow-inset);
}

.patient-appointment-calendar-icon::before {
  content: "";
  width: 27px;
  height: 27px;
  background: var(--primary-active);
  -webkit-mask: var(--icon-calendar) center / contain no-repeat;
  mask: var(--icon-calendar) center / contain no-repeat;
}

.patient-next-appointment-summary .eyebrow,
.care-team-appointment-heading .eyebrow {
  margin-bottom: 3px;
}

.patient-next-appointment-summary h3,
.care-team-appointment-heading h4 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 1.08rem;
}

.patient-next-appointment-value,
.care-team-appointment-current {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.patient-appointment-change {
  justify-self: start;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.patient-appointment-change > summary {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid var(--primary-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--primary-active);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.patient-appointment-change > summary::-webkit-details-marker {
  display: none;
}

.patient-appointment-change > summary:focus-visible {
  outline: 3px solid rgba(7, 83, 125, 0.28);
  outline-offset: 2px;
}

.patient-appointment-change-form {
  display: grid;
  gap: 13px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
}

.patient-appointment-change-form > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.5;
}


.care-team-no-next-appointment {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.care-team-no-next-appointment input {
  margin: 0;
}

.patient-appointment-change-fields,
.care-team-appointment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.patient-appointment-change-fields .primary-btn,
.care-team-appointment-form .primary-btn {
  min-height: 44px;
  white-space: nowrap;
}

.patient-appointment-request-status,
.care-team-appointment-request {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(146, 104, 14, 0.2);
  border-radius: var(--radius-lg);
  background: rgba(255, 247, 214, 0.72);
  color: var(--ink-soft);
}

.patient-appointment-request-status {
  display: grid;
  gap: 3px;
}

.patient-appointment-request-status span,
.care-team-appointment-request small,
.appointment-request-label {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.patient-appointment-request-status strong,
.care-team-appointment-request strong {
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: 0.84rem;
}

.patient-appointment-request-status.approved,
.care-team-appointment-request.approved {
  border-color: rgba(22, 128, 85, 0.2);
  background: rgba(225, 248, 238, 0.78);
}

.patient-appointment-request-status.declined,
.care-team-appointment-request.declined {
  border-color: rgba(180, 35, 24, 0.18);
  background: rgba(255, 237, 234, 0.72);
}

.care-team-appointment-panel {
  padding: 17px;
  border-radius: var(--radius-lg);
  background: rgba(242, 253, 254, 0.66);
  box-shadow: var(--shadow-inset);
}

.care-team-appointment-heading {
  justify-content: space-between;
}

.care-team-appointment-heading > .badge {
  flex: 0 0 auto;
}

.care-team-appointment-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.care-team-appointment-request > div:first-child {
  display: grid;
  gap: 3px;
}

.appointment-request-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

@media (max-width: 760px) {
  .patient-next-appointment-summary,
  .care-team-appointment-heading,
  .care-team-appointment-request {
    align-items: flex-start;
  }

  .patient-appointment-change-fields,
  .care-team-appointment-form {
    grid-template-columns: 1fr;
  }

  .patient-appointment-change-fields .primary-btn,
  .care-team-appointment-form .primary-btn {
    width: 100%;
  }

  .care-team-appointment-request {
    flex-direction: column;
  }

  .appointment-request-actions,
  .appointment-request-actions > button {
    width: 100%;
  }
}

/* ========================================================================== */
/* Patient portal viewport and screen-comfort safeguards                       */
/* ========================================================================== */

/* The experience is fixed over the portal, so lock the underlying document as
   soon as it is mounted. This removes the otherwise-visible portal scrollbar
   without preventing a genuinely tall intro/results card from being panned. */
html:has(#patientExerciseExperience),
body:has(#patientExerciseExperience) {
  overflow: hidden;
  overscroll-behavior: none;
}

.patient-experience-backdrop,
.patient-experience-dialog,
.patient-experience-screen {
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.patient-experience-backdrop::-webkit-scrollbar,
.patient-experience-dialog::-webkit-scrollbar,
.patient-experience-screen::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Accent text is deliberately separate from --primary-active: the latter is
   also used as a filled-control color and is therefore intentionally dark. */
.app-shell[data-role="patient"][data-patient-visual-mode="low-glare"] {
  --comfort-accent-text: #214249;
}

.app-shell[data-role="patient"][data-patient-visual-mode="warm-tint"] {
  --comfort-accent-text: #49392b;
}

.app-shell[data-role="patient"][data-patient-visual-mode="dark-comfort"] {
  --comfort-accent-text: #9fd8d7;
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.sidebar-brand strong, .sidebar-user strong) {
  color: var(--ink-strong);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.sidebar-brand small, .sidebar-user small, .nav-section-label) {
  color: var(--muted);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .nav-btn {
  color: var(--ink-soft);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(
  .content-header .eyebrow,
  .patient-workspace .eyebrow,
  .portal-exercise-category,
  .experience-step-kicker,
  .patient-program-icon,
  .portal-exercise-visual,
  .patient-program-security-icon,
  .breathing-header-icon,
  .experience-intro-art,
  .experience-note-icon
) {
  color: var(--comfort-accent-text);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(
  .nav-btn.active,
  .secondary-btn,
  .soft-btn,
  .compact-btn,
  .voice-btn,
  .voice-done-btn
) {
  color: var(--comfort-accent-text);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) :is(.nav-active-indicator, .experience-completion-hint) {
  border-color: var(--comfort-border);
  background: var(--comfort-chip);
  color: var(--ink-soft);
}

.app-shell[data-role="patient"]:is(
  [data-patient-visual-mode="low-glare"],
  [data-patient-visual-mode="warm-tint"],
  [data-patient-visual-mode="dark-comfort"]
) .patient-appointment-calendar-icon::before {
  background: var(--comfort-accent-text);
}

@media (max-width: 760px) {
  /* On phones the logout action belongs to the existing user panel; removing
     its second surface avoids the nested-card/shadow effect. */
  .app-shell[data-role="patient"] .sidebar-user #logoutBtn {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  /* Standalone visual scanning is identifiable from its component URL. Full/Brief cognitive monitoring
     workflows expose their current component on the experience hook. */
  :is(
    #patientExerciseExperience[data-monitoring-component="visual-scanning"] .patient-experience-active,
    .patient-experience-active:has(> .experience-game-stage > .experience-game-frame[src*="monitoringComponent=visual-scanning"])
  ) > .experience-live-header {
    display: none;
  }

  :is(
    #patientExerciseExperience[data-monitoring-component="visual-scanning"] .patient-experience-active,
    .patient-experience-active:has(> .experience-game-stage > .experience-game-frame[src*="monitoringComponent=visual-scanning"])
  ) > .experience-game-stage,
  :is(
    #patientExerciseExperience[data-monitoring-component="visual-scanning"] .patient-experience-active,
    .patient-experience-active:has(> .experience-game-stage > .experience-game-frame[src*="monitoringComponent=visual-scanning"])
  ) > .experience-game-stage > .experience-game-frame {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
}


/* 2026-08-21 targeted patient-portal refinements. */
@media (max-width: 760px) {
  /* One compact mobile logout treatment for every account role. */
  .app-shell .sidebar-user #logoutBtn {
    width: auto !important;
    min-width: 0 !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 12px !important;
    gap: 6px !important;
    justify-self: start;
    justify-content: center;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: .78rem !important;
    line-height: 1 !important;
  }
  .app-shell .sidebar-user #logoutBtn .logout-icon {
    width: 15px !important;
    height: 15px !important;
    flex: 0 0 15px;
  }
}

/* Keep multiplication/close glyphs optically centered in modal buttons. */
.modal-x[aria-label^="Close"],
.experience-close-btn,
button[class*="close"][aria-label^="Close"],
button[class*="close"][title^="Close"] {
  display: inline-grid !important;
  place-items: center !important;
  align-content: center !important;
  justify-content: center !important;
  padding: 0 !important;
  text-align: center !important;
  line-height: 1 !important;
}
.modal-x[aria-label^="Close"] { width: 44px; height: 44px; }
.experience-close-btn { padding: 0 !important; }

/* Mind Clouds cloud-level graph: level boundaries remain legible at a glance. */
.exercise-progress-graph-cloud-levels .exercise-graph-cloud-boundary line {
  stroke-width: 1.4;
  opacity: .78;
}
.exercise-progress-graph-cloud-levels .exercise-graph-y-tick text {
  font-size: 10px;
}
.exercise-progress-graph-cloud-levels .exercise-graph-cloud-compact-label text {
  font-size: 9px;
  font-weight: 700;
}

/* Embedded video exercises use a compact, stable chrome on phones so the
   player and assigned follow-up practice surface receive the viewport. */
@media (max-width: 760px) {
  .patient-experience-active.is-video-exercise > .experience-live-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 58px;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  }

  .patient-experience-active.is-video-exercise .experience-live-title {
    gap: 9px;
  }

  .patient-experience-active.is-video-exercise .experience-live-title .live-status-dot {
    flex-basis: 8px;
    width: 8px;
    height: 8px;
  }

  .patient-experience-active.is-video-exercise .experience-live-title strong {
    font-size: clamp(0.78rem, 3.5vw, 0.9rem);
  }

  .patient-experience-active.is-video-exercise .experience-live-clock {
    min-width: 72px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-inset);
    font-size: 0.98rem;
  }

  .patient-experience-active.is-video-exercise > .experience-live-header > .experience-completion-hint {
    display: none;
  }

  .patient-experience-active.is-video-exercise > .experience-game-stage {
    min-height: 0;
    background: #eef9fa;
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .patient-experience-active.is-video-exercise > .experience-live-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 48px;
    padding: max(5px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 5px max(10px, env(safe-area-inset-left));
  }

  .patient-experience-active.is-video-exercise .experience-live-title > div > span,
  .patient-experience-active.is-video-exercise > .experience-live-header > .experience-completion-hint {
    display: none;
  }

  .patient-experience-active.is-video-exercise .experience-live-clock {
    min-width: 70px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9rem;
  }
}

/* 2026-08-25 care-team workspace alignment and density refinements. */
.history-card .history-filter-row {
  grid-template-columns:
    minmax(0, 0.72fr)
    minmax(0, 0.72fr)
    minmax(0, 1fr)
    minmax(0, 1.04fr)
    minmax(0, 0.92fr)
    auto;
  gap: 8px;
}

.history-card .history-filter-row > * {
  min-width: 0;
}

#mainContent[data-view="patientPage"] {
  gap: 16px;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
}

#mainContent[data-view="patientPage"] .patient-page-intro {
  gap: 16px;
  padding: 14px 18px;
}

#mainContent[data-view="patientPage"] .patient-page-intro .card-header h2 {
  font-size: 1.12rem;
}

#mainContent[data-view="patientPage"] > .section-stack {
  gap: 14px;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
}

#mainContent[data-view="patientPage"] .ta-patient-section {
  padding: 18px;
}

#mainContent[data-view="patientPage"] .ta-patient-section > .section-header {
  align-items: center;
  margin: -18px -18px 14px;
  padding: 13px 18px;
  background: linear-gradient(135deg, rgba(227, 244, 252, 0.82), rgba(247, 252, 255, 0.72));
}

#mainContent[data-view="patientPage"] .ta-patient-section > .section-header p {
  margin-top: 2px;
}

#mainContent[data-view="patientPage"] .ta-section-body {
  gap: 14px;
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.46);
  box-shadow: var(--shadow-inset);
}

#mainContent[data-view="patientPage"] :is(
  .staff-only-note-section,
  .session-status-section,
  .exercise-row,
  .care-team-appointment-panel
) {
  padding: 12px;
}

#mainContent[data-view="patientPage"] :is(
  .staff-only-note-section,
  .session-status-section
) {
  gap: 6px;
}

#mainContent[data-view="patientPage"] .staff-only-note-section textarea {
  min-height: 76px;
}

#mainContent[data-view="patientPage"] .ta-exercise-list {
  gap: 10px;
}

@media (min-width: 901px) {
  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
    grid-template-columns:
      minmax(0, 1.55fr)
      minmax(0, 1.02fr)
      minmax(0, 0.74fr)
      minmax(0, 1.1fr)
      minmax(0, 0.9fr);
  }
}

@media (max-width: 1180px) {
  .history-card .history-filter-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .history-card .history-filter-row > button {
    width: 100%;
  }
}

/* At the compact-navigation breakpoint the sidebar moves above the content,
   restoring enough horizontal room for the single-row filter toolbar. */
@media (min-width: 901px) and (max-width: 1024px) {
  .history-card .history-filter-row {
    grid-template-columns:
      minmax(0, 0.72fr)
      minmax(0, 0.72fr)
      minmax(0, 1fr)
      minmax(0, 1.04fr)
      minmax(0, 0.92fr)
      auto;
  }

  .history-card .history-filter-row > button {
    width: auto;
  }
}

@media (max-width: 900px) {
  .history-card .history-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .history-card .history-filter-row,
  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
    grid-template-columns: minmax(0, 1fr);
  }

  #mainContent[data-view="patientPage"] .patient-page-intro,
  #mainContent[data-view="patientPage"] .ta-patient-section {
    padding: 14px;
  }

  #mainContent[data-view="patientPage"] .ta-patient-section > .section-header {
    margin: -14px -14px 14px;
    padding: 13px 14px;
  }
}

/* 2026-08-31 care-team game-level authority, care-team-only removal, and inactivity warning. */
.exercise-row.has-game-level:not(.readonly-exercise-row) {
  grid-template-columns:
    minmax(100px, .42fr)
    minmax(185px, 1fr)
    minmax(112px, .45fr)
    minmax(124px, .5fr)
    minmax(210px, 1.1fr);
}
.exercise-row > .game-level-field,
.patient-exercise-option > .patient-exercise-level-field {
  min-width: 0;
}
.game-level-field select,
.patient-exercise-level-field select {
  width: 100%;
  min-width: 0;
}
.game-level-field label,
.patient-exercise-level-field label {
  white-space: nowrap;
}
.care-team-exercise-row-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}
.care-team-remove-exercise-btn {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid rgba(185, 28, 28, .34);
  border-radius: 10px;
  background: rgba(254, 242, 242, .92);
  color: #991b1b;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}
.care-team-remove-exercise-btn:hover {
  border-color: rgba(185, 28, 28, .56);
  background: #fee2e2;
}
.patient-exercise-option.has-game-level {
  grid-template-columns: 54px minmax(112px,.3fr) minmax(112px,.3fr) minmax(112px,.3fr) minmax(180px,1fr);
  grid-template-areas: "sequence time breathing level exercise";
}
.patient-exercise-option > .patient-exercise-level-field { grid-area: level; gap: 4px; }
.patient-exercise-level-field label { font-size: .7rem; }
.current-exercise-item {
  grid-template-columns: 32px minmax(82px,auto) minmax(0,1fr) minmax(82px,auto) minmax(112px,auto);
  grid-template-areas: "sequence duration name level breathing";
}
.current-exercise-level {
  grid-area: level;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: 1px solid rgba(29,78,216,.2);
  border-radius: 8px;
  background: rgba(239,246,255,.9);
  color: #1d4ed8;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.readonly-exercise-row > .readonly-exercise-summary {
  grid-template-columns: minmax(82px,.38fr) minmax(160px,1fr) minmax(94px,.42fr) minmax(110px,.5fr);
}
.inactivity-warning-backdrop { z-index: 5000; }
.inactivity-warning-card { max-width: 520px; }
.inactivity-warning-actions { gap: 10px; }
.inactivity-warning-card [data-inactivity-countdown] {
  display: inline-block;
  min-width: 2ch;
  color: #b45309;
  font-size: 1.05em;
  font-variant-numeric: tabular-nums;
}

@media (max-width:1280px) {
  .exercise-row.has-game-level:not(.readonly-exercise-row) {
    grid-template-columns: minmax(100px,.42fr) minmax(175px,1fr) minmax(108px,.44fr) minmax(118px,.48fr);
  }
  .exercise-row.has-game-level:not(.readonly-exercise-row) > .note-review-field { grid-column:1 / -1; }
}
@media (max-width:768px) {
  .exercise-row.has-game-level:not(.readonly-exercise-row) { grid-template-columns:minmax(0,1fr); }
  .patient-exercise-option.has-game-level {
    grid-template-columns:54px minmax(0,1fr) minmax(112px,.45fr);
    grid-template-areas:
      "sequence exercise exercise"
      "time time breathing"
      "level level level";
  }
  .current-exercise-item {
    grid-template-columns:30px minmax(82px,auto) minmax(0,1fr);
    grid-template-areas:
      "sequence duration name"
      "sequence level breathing";
  }
  .current-exercise-level,.current-exercise-breathing { justify-self:start; }
  .readonly-exercise-row > .readonly-exercise-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:520px) {
  .patient-exercise-option.has-game-level {
    grid-template-columns:52px minmax(0,1fr);
    grid-template-areas:
      "sequence exercise"
      "time time"
      "breathing breathing"
      "level level";
  }
  .current-exercise-item {
    grid-template-columns:30px minmax(0,1fr);
    grid-template-areas:
      "sequence name"
      "duration duration"
      "level level"
      "breathing breathing";
  }
  .readonly-exercise-row > .readonly-exercise-summary { grid-template-columns:minmax(0,1fr); }
  .inactivity-warning-actions { display:grid; grid-template-columns:1fr; }
  .inactivity-warning-actions > button { width:100%; }
}

/* Patient pacing alerts */
.pace-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pace-status-pill.too-fast {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}
.pace-status-pill.too-slow {
  color: #1e40af;
  background: #eff6ff;
  border-color: #93c5fd;
}
.pace-status-pill.compact {
  min-height: 24px;
  padding: 3px 9px;
  justify-self: start;
}

/* Prevent the login screen from flashing while an existing authenticated SPA
   session is being restored after returning from a dedicated exercise page. */
html.notes-form-booting body.app-booting #authScreen{visibility:hidden;}
html.notes-form-booting body.app-booting #appShell{visibility:hidden;}

/* Keep assigned exercise names readable even when the Patient List detail pane
   is narrow. Timing/status chips wrap beneath the full-width name instead of
   squeezing it into a word-breaking column. */
.current-exercise-item {
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-areas: "sequence content";
  align-items: start;
}
.current-exercise-item > .current-exercise-sequence {
  grid-area: sequence;
  align-self: start;
}
.current-exercise-content {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-area: content;
  gap: 8px;
}
.current-exercise-name {
  min-width: 0;
  width: 100%;
  display: block;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}
.current-exercise-details {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.current-exercise-details > :is(.current-exercise-duration, .current-exercise-level, .current-exercise-breathing, .pace-status-pill) {
  flex: 0 0 auto;
  justify-self: auto;
}
@media (max-width: 520px) {
  .current-exercise-item {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas: "sequence content";
  }
}

.staff-exercise-monitor.break .live-status-dot {
  background: #0f8a9d;
  box-shadow: 0 0 0 4px rgba(15, 138, 157, 0.13);
}

.patient-experience-break {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: max(26px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}
.experience-break-card {
  width: min(680px, 100%);
  padding: clamp(30px, 6vw, 64px);
  border: 1px solid var(--glass-line);
  border-radius: 30px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-lg);
  text-align: center;
  -webkit-backdrop-filter: blur(24px) saturate(1.06);
  backdrop-filter: blur(24px) saturate(1.06);
}
.experience-break-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border: 9px solid rgba(15, 138, 157, 0.13);
  border-top-color: #0f8a9d;
  border-radius: 50%;
  animation: recovery-break-breathe 4s ease-in-out infinite;
}
.experience-break-card h2 {
  margin-bottom: 12px;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
}
.experience-break-card > p {
  max-width: 520px;
  margin: 0 auto;
  color: var(--muted);
}
.experience-break-countdown {
  display: grid;
  width: min(310px, 100%);
  margin: 30px auto 0;
  padding: 24px;
  border: 1px solid var(--primary-line);
  border-radius: 24px;
  background: rgba(221, 247, 248, 0.72);
}
.experience-break-countdown strong {
  color: var(--ink-strong);
  font-size: clamp(2.7rem, 10vw, 5rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
}
.experience-break-countdown span {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
@keyframes recovery-break-breathe {
  0%, 100% { transform: scale(0.92); opacity: 0.72; }
  50% { transform: scale(1.06); opacity: 1; }
}
@media (max-width: 520px) {
  .patient-experience-break { align-items: flex-start; padding: 60px 12px 16px; }
  .experience-break-card { padding: 28px 18px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .experience-break-icon { animation: none; }
}

/* ========================================================================== */
/* Pre-Phase 29 responsive hardening — layout only, no workflow changes.       */
/* ========================================================================== */
:where(.app-shell,.content-area,.main-content,.card,.panel,.patient-list-pane,.patient-detail-pane,
  .patient-tab-panel,.portal-exercise-card,.management-panel,.assignment-card,.history-card,
  .workspace-tabs,.panel-header,.section-header,.card-header,.patient-detail-header,.patient-detail-identity,
  .patient-detail-actions,.header-actions,.content-header,.actions-row) { min-width: 0; }

:where(.main-content,.patient-tab-panel,.card,.panel,.management-panel,.portal-exercise-card) :where(h1,h2,h3,h4,h5,p,span,strong,small,label) {
  max-width: 100%;
  overflow-wrap: anywhere;
}

:where(.main-content,.patient-tab-panel,.modal,.patient-exercise-experience) :where(img,svg,video,canvas) {
  max-width: 100%;
}

:where(.primary-btn,.secondary-btn,.soft-btn,.success-btn,.danger-btn,.warning-btn,.compact-btn,.voice-btn,.voice-done-btn,.workspace-tab,.nav-btn) {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

:where(.primary-btn,.secondary-btn,.soft-btn,.success-btn,.danger-btn,.warning-btn,.compact-btn,.voice-btn,.voice-done-btn) :where(svg,img),
:where(.workspace-tab,.nav-btn)::before {
  flex-shrink: 0;
}

.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
table { max-width: 100%; }

.scheduling-requests-panel { min-width:0; display:grid; gap:14px; }
.scheduling-requests-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; min-width:0; }
.scheduling-requests-heading > * { min-width:0; }
.scheduling-request-list { display:grid; gap:10px; min-width:0; }
.scheduling-request-row {
  display:grid;
  grid-template-columns:minmax(150px,.36fr) minmax(0,1fr);
  gap:14px;
  align-items:start;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  background:var(--surface);
}
.scheduling-request-date,.scheduling-request-detail { min-width:0; }
.scheduling-request-date { display:grid; gap:4px; color:var(--muted); font-size:.76rem; }
.scheduling-request-date-label { color:var(--ink-soft); font-size:.68rem; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.scheduling-request-detail-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; min-width:0; }
.scheduling-request-detail-head > * { min-width:0; }
.scheduling-request-time { margin-top:6px; color:var(--ink-strong); font-size:.9rem; font-weight:750; overflow-wrap:anywhere; }
.scheduling-request-actions { margin-top:10px; justify-content:flex-start; }

@media (max-width: 1180px) {
  .content-header { gap:14px; padding-inline:clamp(16px,2.3vw,28px); }
  .main-content { padding:clamp(16px,2.2vw,26px); gap:16px; }
  #mainContent[data-view="overview"] { grid-template-columns:minmax(0,1fr); }
  .patient-directory-layout { grid-template-columns:minmax(220px,260px) minmax(0,1fr); gap:14px; }
  .patient-detail-header { align-items:flex-start; flex-wrap:wrap; }
  .patient-detail-actions { width:100%; justify-content:flex-start; }
  .portal-exercise-list { gap:14px; padding:16px; }
  .portal-exercise-card { grid-template-columns:auto 68px minmax(0,1fr); gap:9px 12px; padding:16px; min-height:190px; }
  .portal-exercise-visual { width:68px; height:68px; }
  .portal-exercise-visual svg { width:34px; height:34px; }
}

@media (max-width: 900px) {
  .content-header { min-height:72px; flex-wrap:wrap; align-items:flex-start; }
  .header-title-group { flex:1 1 260px; }
  .header-actions { flex:1 1 auto; flex-wrap:wrap; justify-content:flex-start; }
  .content-header h1 { white-space:normal; text-overflow:clip; line-height:1.15; }
  .patient-directory-layout { grid-template-columns:1fr; }
  .patient-list-pane { max-height:none; }
  .patient-rail-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .patient-detail-pane > .workspace-tabs { overflow-x:auto; }
  .portal-exercise-list { grid-template-columns:1fr; }
  .scheduling-request-row { grid-template-columns:1fr; }
}

@media (max-width: 768px) {
  .main-content { padding:12px; gap:12px; }
  .content-header { padding:12px 14px; }
  .header-actions { gap:7px; width:100%; }
  .header-pill { min-height:34px; padding:6px 8px; font-size:.7rem; }
  .panel-header,.section-header,.card-header,.patient-list-pane-header,.patient-panel-intro,.access-section-heading {
    align-items:flex-start;
    flex-wrap:wrap;
    gap:10px;
  }
  .panel-header > .actions-row,.section-header > .actions-row,.card-header > .actions-row { width:100%; justify-content:flex-start; }
  .patient-detail-header { padding:14px; }
  .patient-detail-avatar { width:42px; height:42px; flex-basis:42px; border-radius:11px; }
  .patient-detail-header h2 { font-size:1.05rem; }
  .patient-tab-panel { padding:14px; }
  .workspace-tabs { gap:4px; }
  .workspace-tab { min-height:40px; padding:8px 10px; font-size:.76rem; flex:0 0 auto; }
  .patient-rail-list { grid-template-columns:1fr; }
  .portal-exercise-list { padding:10px; gap:10px; }
  .portal-exercise-card {
    grid-template-columns:30px 54px minmax(0,1fr);
    grid-template-areas:"sequence visual copy" "action action action";
    min-height:0;
    padding:13px;
  }
  .portal-exercise-sequence { width:30px; height:30px; border-radius:9px; }
  .portal-exercise-visual { width:54px; height:54px; }
  .portal-exercise-visual svg { width:28px; height:28px; }
  .portal-exercise-card h4 { font-size:.92rem; }
  .portal-exercise-card p { font-size:.74rem; }
  .portal-exercise-action { width:100%; min-width:0; }
  .portal-exercise-action :is(button,.primary-btn,.secondary-btn) { width:100%; }
  .scheduling-request-actions { width:100%; }
  .scheduling-request-actions > * { flex:1 1 120px; }
}

@media (max-width: 520px) {
  .content-header { gap:8px; }
  .content-header h1 { font-size:1.25rem; }
  .header-actions > * { max-width:100%; }
  .patient-detail-identity { align-items:flex-start; }
  .patient-detail-actions > * { flex:1 1 140px; }
  .actions-row { flex-wrap:wrap; }
  .actions-row > :is(button,.primary-btn,.secondary-btn,.soft-btn,.danger-btn,.success-btn,.warning-btn) { flex:1 1 130px; }
  .portal-exercise-card { grid-template-columns:28px 46px minmax(0,1fr); gap:8px; padding:11px; border-radius:15px; }
  .portal-exercise-sequence { width:28px; height:28px; font-size:.7rem; }
  .portal-exercise-visual { width:46px; height:46px; }
  .portal-exercise-visual svg { width:24px; height:24px; }
  .portal-exercise-card-topline { align-items:flex-start; }
  .portal-exercise-category,.portal-exercise-state { font-size:.58rem; white-space:normal; text-overflow:clip; }
  .scheduling-request-row { padding:11px; }
  .scheduling-request-detail-head { align-items:flex-start; }
}

/* Access Control: future-account registration and email MFA */
.registration-mfa-toggle {
  align-items: center;
  min-height: 72px;
}

.registration-mfa-toggle input {
  flex: 0 0 auto;
}

.registration-email-field .required-mark {
  margin-left: 6px;
  color: var(--primary-active);
  font-size: 0.7rem;
  font-weight: 700;
}

.login-mfa-card {
  width: min(92vw, 520px);
}

.login-mfa-code-field {
  max-width: 280px;
  margin: 18px auto 0;
}

.login-mfa-code-field label {
  text-align: center;
}

.login-mfa-code-field input {
  min-height: 56px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.38em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .login-mfa-code-field {
    max-width: none;
  }

  .login-mfa-code-field input {
    font-size: 1.2rem;
    letter-spacing: 0.28em;
  }
}

/* 2026-09-10 Patient Page visual hierarchy refresh (v28).
   Scope is intentionally limited to the Care Team Patient Page, except for
   the Scheduling Requests tab icon fix used on the Patient List page. */

/* Scheduling Requests previously had no mask assigned, so the generic
   currentColor square rendered as a solid block. Reuse the site's calendar
   vector language for a clear scheduling affordance. */
.tab-icon-schedule {
  -webkit-mask-image: var(--icon-calendar);
  mask-image: var(--icon-calendar);
}

/* Patient Page: polished, clinical workspace hierarchy. */
#mainContent[data-view="patientPage"] {
  gap: 20px;
}

#mainContent[data-view="patientPage"] .patient-page-intro {
  position: relative;
  overflow: hidden;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(8, 125, 159, 0.26);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 18%, rgba(12, 181, 203, 0.14), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #f4fbfd 58%, #ebf8fb 100%);
  box-shadow: 0 10px 28px rgba(5, 60, 96, 0.07);
}

#mainContent[data-view="patientPage"] .patient-page-intro::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--nav), var(--accent-cyan));
}

#mainContent[data-view="patientPage"] .patient-page-intro .card-header {
  position: relative;
  z-index: 1;
}

#mainContent[data-view="patientPage"] .patient-page-intro .card-header h2 {
  color: var(--ink-strong);
  font-size: clamp(1.14rem, 1.2vw, 1.28rem);
  font-weight: 780;
  letter-spacing: -0.03em;
}

#mainContent[data-view="patientPage"] .patient-page-controls {
  position: relative;
  z-index: 1;
  padding: 8px;
  border: 1px solid rgba(9, 95, 137, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 3px 12px rgba(5, 60, 96, 0.045);
}

#mainContent[data-view="patientPage"] .section-stack {
  gap: 18px;
}

#mainContent[data-view="patientPage"] .ta-patient-section {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(9, 83, 126, 0.2);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(5, 60, 96, 0.075);
}

#mainContent[data-view="patientPage"] .ta-patient-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--nav), var(--primary), var(--accent-cyan));
  opacity: 0.9;
}

#mainContent[data-view="patientPage"] .ta-patient-section > .section-header {
  position: relative;
  align-items: center;
  gap: 16px;
  margin: -20px -20px 18px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(9, 83, 126, 0.14);
  background:
    radial-gradient(circle at 94% 0%, rgba(12, 181, 203, 0.1), transparent 32%),
    linear-gradient(135deg, #f8fcff 0%, #eef8fc 100%);
}

#mainContent[data-view="patientPage"] .ta-patient-section > .section-header h3 {
  color: #0b3d70;
  font-size: 1.06rem;
  font-weight: 780;
  letter-spacing: -0.025em;
}

#mainContent[data-view="patientPage"] .ta-patient-section > .section-header p {
  margin: 4px 0 0;
  color: #426680;
  font-size: 0.8rem;
  font-weight: 620;
}

#mainContent[data-view="patientPage"] .ta-patient-section > .section-header .actions-row {
  justify-content: flex-end;
}

#mainContent[data-view="patientPage"] .ta-section-body {
  gap: 16px;
}

/* The five primary patient/session fields become individually scannable
   information cards. The colors are deliberately soft and restrained so the
   page remains connected to the site's blue/cyan clinical palette. */
#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field {
  --patient-meta-accent: #087d9f;
  --patient-meta-label: #07537d;
  --patient-meta-tint: rgba(12, 181, 203, 0.075);
  --patient-meta-border: rgba(8, 125, 159, 0.24);
  --patient-meta-focus-ring: rgba(8, 125, 159, 0.14);
  position: relative;
  min-height: 104px;
  align-content: end;
  gap: 7px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--patient-meta-border);
  border-radius: 13px;
  background: linear-gradient(180deg, var(--patient-meta-tint), rgba(255, 255, 255, 0.96));
  box-shadow: 0 3px 10px rgba(5, 60, 96, 0.04);
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--patient-meta-accent);
}

/* Patient Name */
#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field:nth-child(1) {
  --patient-meta-accent: #1667a8;
  --patient-meta-label: #12568c;
  --patient-meta-tint: rgba(22, 103, 168, 0.085);
  --patient-meta-border: rgba(22, 103, 168, 0.24);
  --patient-meta-focus-ring: rgba(22, 103, 168, 0.14);
}

/* Date */
#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field:nth-child(2) {
  --patient-meta-accent: #07877b;
  --patient-meta-label: #06695f;
  --patient-meta-tint: rgba(7, 135, 123, 0.08);
  --patient-meta-border: rgba(7, 135, 123, 0.24);
  --patient-meta-focus-ring: rgba(7, 135, 123, 0.14);
}

/* Time */
#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field:nth-child(3) {
  --patient-meta-accent: #5968ad;
  --patient-meta-label: #48558f;
  --patient-meta-tint: rgba(89, 104, 173, 0.075);
  --patient-meta-border: rgba(89, 104, 173, 0.23);
  --patient-meta-focus-ring: rgba(89, 104, 173, 0.14);
}

/* Visit Type */
#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field:nth-child(4) {
  --patient-meta-accent: #b06d16;
  --patient-meta-label: #87520f;
  --patient-meta-tint: rgba(176, 109, 22, 0.075);
  --patient-meta-border: rgba(176, 109, 22, 0.23);
  --patient-meta-focus-ring: rgba(176, 109, 22, 0.14);
}

/* Number of Exercises */
#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field:nth-child(5) {
  --patient-meta-accent: #2d7d57;
  --patient-meta-label: #236445;
  --patient-meta-tint: rgba(45, 125, 87, 0.075);
  --patient-meta-border: rgba(45, 125, 87, 0.23);
  --patient-meta-focus-ring: rgba(45, 125, 87, 0.14);
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field > label {
  color: var(--patient-meta-label);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field > :is(input, select) {
  min-height: 42px;
  border-color: var(--patient-meta-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: #153f60;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(5, 60, 96, 0.035);
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field > :is(input, select):focus {
  border-color: var(--patient-meta-accent);
  box-shadow: 0 0 0 3px var(--patient-meta-focus-ring);
}

#mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field > :is(input, select):disabled {
  border-color: rgba(9, 83, 126, 0.12);
  background: rgba(232, 242, 246, 0.76);
  color: #567187;
}

/* Secondary Patient Page content gets quieter grouping so the primary
   patient/session strip remains the first visual read. */
#mainContent[data-view="patientPage"] :is(
  .care-team-appointment-panel,
  .staff-only-note-section,
  .session-status-section
) {
  border: 1px solid rgba(9, 83, 126, 0.14);
  border-radius: 14px;
  background: #fbfdfe;
  box-shadow: none;
}

#mainContent[data-view="patientPage"] .care-team-appointment-panel {
  padding: 15px;
  background: linear-gradient(135deg, rgba(229, 248, 250, 0.72), #ffffff 62%);
}

#mainContent[data-view="patientPage"] .care-team-appointment-heading h4 {
  color: #0b4f72;
  font-size: 0.98rem;
}

#mainContent[data-view="patientPage"] .staff-only-note-section {
  position: relative;
  padding: 14px 14px 14px 17px;
  background: #fbfdfe;
}

#mainContent[data-view="patientPage"] .staff-only-note-section::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
}

#mainContent[data-view="patientPage"] .staff-only-note-section.doctor-note-section::before {
  background: #5968ad;
}

#mainContent[data-view="patientPage"] .staff-only-note-section > :is(label, .staff-note-label),
#mainContent[data-view="patientPage"] .session-status-section > :is(label, .session-status-label) {
  color: #234f71;
  font-size: 0.76rem;
  font-weight: 780;
}

#mainContent[data-view="patientPage"] .staff-only-note-section textarea {
  min-height: 82px;
  border-radius: 11px;
  background: #fff;
}

#mainContent[data-view="patientPage"] .ta-exercise-list {
  gap: 12px;
}

#mainContent[data-view="patientPage"] .exercise-row:not(.readonly-exercise-row) {
  position: relative;
  padding: 15px;
  border: 1px solid rgba(9, 83, 126, 0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fcfd 100%);
  box-shadow: 0 3px 10px rgba(5, 60, 96, 0.035);
}

#mainContent[data-view="patientPage"] .exercise-row:not(.readonly-exercise-row)::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
}

#mainContent[data-view="patientPage"] .exercise-row:not(.readonly-exercise-row) .form-field > label {
  color: #315a73;
  font-size: 0.74rem;
  font-weight: 750;
}

#mainContent[data-view="patientPage"] .session-status-section {
  padding: 14px;
  background: linear-gradient(135deg, #f7fbfc, #ffffff);
}

#mainContent[data-view="patientPage"] .patient-actions {
  padding-top: 2px;
}

#mainContent[data-view="patientPage"] .patient-actions .primary-btn {
  min-height: 42px;
  padding-inline: 18px;
  border-radius: 11px;
  box-shadow: 0 5px 14px rgba(8, 125, 159, 0.13);
}

#mainContent[data-view="patientPage"] .assignment-readonly-notice {
  border-radius: 12px;
}

@media (min-width: 901px) {
  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
    grid-template-columns:
      minmax(210px, 1.55fr)
      minmax(150px, 1fr)
      minmax(135px, 0.78fr)
      minmax(165px, 1.08fr)
      minmax(145px, 0.9fr);
  }
}

@media (max-width: 1100px) and (min-width: 769px) {
  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  #mainContent[data-view="patientPage"] {
    gap: 14px;
  }

  #mainContent[data-view="patientPage"] .patient-page-intro,
  #mainContent[data-view="patientPage"] .ta-patient-section {
    padding: 15px;
    border-radius: 15px;
  }

  #mainContent[data-view="patientPage"] .ta-patient-section > .section-header {
    align-items: flex-start;
    margin: -15px -15px 15px;
    padding: 16px 15px 14px;
  }

  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) {
    grid-template-columns: minmax(0, 1fr);
  }

  #mainContent[data-view="patientPage"] .ta-section-body > .ta-section-grid:not(.readonly-history-meta-grid) > .form-field {
    min-height: 96px;
  }
}

@media (max-width: 560px) {
  #mainContent[data-view="patientPage"] .ta-patient-section > .section-header {
    display: grid;
  }

  #mainContent[data-view="patientPage"] .ta-patient-section > .section-header .actions-row {
    width: 100%;
    justify-content: flex-start;
  }

  #mainContent[data-view="patientPage"] .patient-page-controls {
    padding: 7px;
  }
}


/* v30: keep the History Actions icon as three dots on one horizontal line. */
.history-actions-ellipsis {
  display: inline-flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 18px;
  height: 8px;
  white-space: nowrap;
}
.history-actions-ellipsis > i {
  display: block;
  flex: 0 0 4px;
  width: 4px;
  height: 4px;
  margin: 0;
  border-radius: 50%;
  background: currentColor;
}

/* Patient two-page notes flow — mirrors the Exercises-page troubleshooting prototype. */
.patient-warm-welcome {
  max-width: 720px;
  color: var(--ink-soft) !important;
  font-weight: 650;
  line-height: 1.62;
}

.patient-structured-note-card {
  width: min(860px, 100%);
  padding: clamp(22px, 4vw, 38px);
  text-align: left;
}

.patient-note-form-page { display: block; }
.patient-note-page-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}
.patient-note-page-marker span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(8, 125, 159, 0.18);
  border-radius: 50%;
  background: #fff;
  color: #6a8298;
  font-size: 0.72rem;
  font-weight: 800;
}
.patient-note-page-marker span.active { border-color: #087d9f; background: #087d9f; color: #fff; }
.patient-note-page-marker i { width: 38px; height: 1px; background: rgba(8, 125, 159, 0.2); }
.patient-note-form-head { margin-bottom: 16px; text-align: center; }
.patient-note-form-head h2 { margin: 0; color: var(--ink-strong); font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -0.025em; }
.patient-note-form-head p { max-width: 690px; margin: 8px auto 0; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }
.patient-note-assigned-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
  padding: 13px 14px;
  border: 1px solid rgba(8,125,159,.13);
  border-radius: 15px;
  background: rgba(236,250,252,.66);
}
.patient-note-assigned-context > span { color: var(--muted); font-size: .7rem; font-weight: 750; }
.patient-note-assigned-context > div { display: grid; justify-items: end; gap: 2px; text-align: right; }
.patient-note-assigned-context strong { color: var(--ink-strong); font-size: .82rem; }
.patient-note-assigned-context em { color: #52758c; font-size: .65rem; font-style: normal; font-weight: 750; }
.patient-note-honesty-callout {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid rgba(8,125,159,.16);
  border-radius: 14px;
  background: linear-gradient(135deg,#f0fafb,#f8fcfd);
  color: #315c77;
  line-height: 1.48;
}
.patient-note-honesty-callout strong { color: #12385f; font-size: .76rem; }
.patient-note-honesty-callout span { font-size: .72rem; }
.patient-note-prototype-pace {
  margin: 0 0 14px;
  padding: 13px;
  border: 1px solid rgba(8,125,159,.14);
  border-radius: 14px;
  background: #f7fbfc;
}
.patient-note-prototype-pace legend { padding: 0 4px; color: #173a62; font-size: .78rem; font-weight: 800; line-height: 1.4; }
.patient-note-prototype-pace-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
.patient-note-prototype-pace-options label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(8,125,159,.16);
  border-radius: 11px;
  background: #fff;
  color: #315c77;
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}
.patient-note-prototype-pace-options label.selected { border-color: #087d9f; background: #eaf8fa; color: #075f7a; box-shadow: inset 0 0 0 1px rgba(8,125,159,.08); }
.patient-note-prototype-pace-options input { position: absolute; opacity: 0; pointer-events: none; }
.patient-note-symptom-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 11px; }
.patient-note-symptom-choice { position: relative; display: inline-flex !important; align-items: center; margin: 0 !important; cursor: pointer; }
.patient-note-symptom-choice input { position: absolute; opacity: 0; pointer-events: none; }
.patient-note-symptom-choice strong {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(8,125,159,.15);
  border-radius: 999px;
  background: #fff;
  color: #356580;
  font-size: .72rem;
  font-weight: 800;
  transition: .15s ease;
}
.patient-note-symptom-choice.selected strong { border-color: #087d9f; background: #eaf8fa; color: #075f7a; box-shadow: inset 0 0 0 1px rgba(8,125,159,.08); }
.patient-note-show-other {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  margin: 3px 0 11px;
  padding: 8px 12px;
  border: 1px dashed rgba(8,125,159,.25);
  border-radius: 11px;
  background: rgba(247,252,254,.8);
  color: #356580;
  font: inherit;
  font-size: .73rem;
  font-weight: 800;
  cursor: pointer;
}
.patient-note-text-field { display: block; margin: 0; }
.patient-note-text-field > span { display: block; margin-bottom: 7px; color: #173a62; font-size: .76rem; font-weight: 800; }
.patient-note-text-field small { color: var(--muted); font-size: .68rem; font-weight: 650; }
.patient-note-text-field input,
.patient-note-text-field textarea {
  width: 100%;
  border: 1px solid rgba(8,125,159,.18);
  border-radius: 11px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  outline: none;
}
.patient-note-text-field input { height: 42px; padding: 0 12px; }
.patient-note-text-field textarea { min-height: 86px; padding: 11px 12px; line-height: 1.55; resize: vertical; }
.patient-note-text-field input:focus,
.patient-note-text-field textarea:focus { border-color: #087d9f; box-shadow: 0 0 0 3px rgba(12,181,203,.12); }
.patient-note-empty-inline { width: 100%; padding: 12px; border: 1px dashed rgba(8,125,159,.2); border-radius: 12px; color: #71879b; font-size: .72rem; }
.patient-note-page-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.patient-note-page-actions-split { justify-content: space-between; }
.patient-note-selection-count { color: var(--muted); font-size: .7rem; font-weight: 750; }
.patient-note-primary-btn { min-width: 180px; justify-content: center; }
.patient-note-shared-question {
  margin-bottom: 13px;
  padding: 14px 15px;
  border: 1px solid rgba(8,125,159,.14);
  border-radius: 14px;
  background: #eef9fb;
  color: #173a62;
}
.patient-note-shared-question strong { display: block; margin-bottom: 5px; font-size: .78rem; }
.patient-note-shared-question p { margin: 0; color: #000; font-size: 17px; line-height: 1.45; }
.patient-note-all-followups { display: grid; gap: 11px; }
.patient-note-followup-card {
  padding: 15px;
  border: 1px solid rgba(8,125,159,.14);
  border-radius: 16px;
  background: rgba(255,255,255,.9);
}
.patient-note-followup-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.patient-note-followup-title h4 { margin: 0; color: #12385f; font-size: .9rem; }
.patient-note-followup-title em { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; background: #edf7fb; color: #567692; font-size: .62rem; font-style: normal; font-weight: 800; }
.patient-note-other-concerns { margin-top: 14px; padding: 15px; border: 1px solid rgba(8,125,159,.14); border-radius: 16px; background: rgba(255,255,255,.9); }
.patient-structured-note-tools { margin: 8px 0 0; }
.patient-note-speech-help { margin: 9px 2px 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.patient-note-saved-confirmation { max-width: 560px; margin: 18px auto 26px; color: var(--ink-soft); line-height: 1.65; }

@media (max-width: 680px) {
  .patient-structured-note-card { padding: 18px 14px; border-radius: 18px; }
  .patient-note-form-head h2 { font-size: clamp(1.22rem, 6vw, 1.55rem); }
  .patient-note-form-head p { font-size: .75rem; line-height: 1.45; }
  .patient-note-assigned-context { align-items: flex-start; flex-direction: column; }
  .patient-note-assigned-context > div { justify-items: start; text-align: left; }
  .patient-note-prototype-pace-options { grid-template-columns: 1fr; }
  .patient-note-symptom-choice strong { min-height: 36px; padding: 7px 10px; font-size: .68rem; }
  .patient-note-shared-question p { font-size: 15px; }
  .patient-note-followup-title { align-items: flex-start; flex-direction: column; }
  .patient-note-page-actions,
  .patient-note-page-actions-split { align-items: stretch; flex-direction: column; }
  .patient-note-page-actions button { width: 100%; }
  .patient-note-selection-count { text-align: center; }
}

/* ========================================================================== */
/* v36 responsive tabs, mobile pace-card containment                           */
/* ========================================================================== */

/* Patient List and Access Control tab labels are navigation labels, not prose.
   Keep each label intact on one line and let the rail scroll horizontally when
   the available width is narrower than the full set of tabs. */
:is(.patient-detail-pane > .workspace-tabs, .access-tabs) .workspace-tab {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

/* Smaller desktop displays lose horizontal room to the sidebar and patient
   directory. Reduce only navigation density instead of wrapping tab labels. */
@media (min-width: 769px) and (max-width: 1440px) {
  :is(.patient-detail-pane > .workspace-tabs, .access-tabs) {
    gap: 4px;
    overflow-x: auto;
  }

  :is(.patient-detail-pane > .workspace-tabs, .access-tabs) .workspace-tab {
    min-height: 36px;
    padding: 6px 9px;
    gap: 5px;
    font-size: clamp(.66rem, .72vw, .78rem);
    line-height: 1.15;
  }

  :is(.patient-detail-pane > .workspace-tabs, .access-tabs) .tab-icon {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }
}

/* Fieldset/legend have browser-specific intrinsic sizing on mobile. Explicitly
   constrain the pace question to the note card so neither the legend nor an
   option can protrude past the card edge. */
.patient-note-prototype-pace {
  width: 100%;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.patient-note-prototype-pace legend {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
}
.patient-note-prototype-pace-options,
.patient-note-prototype-pace-options label,
.patient-note-prototype-pace-options label span {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.patient-note-prototype-pace-options label span {
  display: block;
  overflow-wrap: break-word;
}

@media (max-width: 680px) {
  .patient-note-prototype-pace {
    padding: 12px 10px 10px;
  }
  .patient-note-prototype-pace legend {
    width: auto;
    padding-inline: 3px;
    font-size: .74rem;
    line-height: 1.35;
  }
  .patient-note-prototype-pace-options {
    width: 100%;
  }
  .patient-note-prototype-pace-options label {
    width: 100%;
    padding: 9px 10px;
  }
}

/* ========================================================================== */
/* v37 adaptive layout system — presentation only                              */
/* ========================================================================== */

:root {
  --adaptive-page-gutter: clamp(14px, 2.35vw, 38px);
  --adaptive-section-gap: clamp(12px, 1.5vw, 20px);
}

html,
body {
  max-width: 100%;
}

body {
  min-width: 0;
}

:where(
  .app-shell,
  .content-area,
  .main-content,
  .section-stack,
  .access-control-shell,
  .patient-directory-layout,
  .patient-list-pane,
  .patient-detail-pane,
  .patient-tab-panel,
  .registration-layout,
  .registration-form,
  .account-directory-filters,
  .daily-patient-assignment-toolbar,
  .exercise-row,
  .readonly-exercise-summary,
  .patient-exercise-option,
  .current-exercise-item,
  .modal-card
) > * {
  min-width: 0;
}

:where(.main-content, .modal-card, .patient-exercise-experience) :where(img, video) {
  max-width: 100%;
  height: auto;
}

:where(.main-content, .modal-card, .patient-exercise-experience) :where(canvas, iframe) {
  max-width: 100%;
}

:where(.experience-game-stage, .patient-experience-screen) iframe {
  width: 100%;
  height: 100%;
}

.main-content {
  gap: var(--adaptive-section-gap);
  padding-inline: var(--adaptive-page-gutter);
}

.content-header {
  padding-inline: var(--adaptive-page-gutter);
}

:where(.workspace-tabs, .access-tabs, .side-nav, .table-wrap) {
  max-width: 100%;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

:where(.workspace-tabs, .access-tabs) {
  scroll-padding-inline: 8px;
  scrollbar-width: thin;
}

/* Compact desktop: recover useful workspace width while preserving the
   existing collapsible sidebar and all of its behavior. */
@media (min-width: 1025px) and (max-width: 1280px) {
  .app-shell {
    grid-template-columns: clamp(224px, 22vw, 260px) minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: clamp(12px, 1.45vw, 18px);
  }

  .content-header {
    min-height: 72px;
  }

  .patient-directory-layout {
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  }
}

@media (max-width: 1180px) and (min-width: 901px) {
  .account-directory-filters {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .account-directory-filters .form-field:not(.account-name-filter) {
    grid-column: span 1;
  }

  .account-directory-filters .account-filter-clear {
    justify-self: start;
  }
}

/* Tablet: retain two-column information density where it fits and allow all
   navigation rails to be reached with a horizontal swipe. */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --adaptive-page-gutter: clamp(18px, 3vw, 28px);
  }

  .app-shell {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .sidebar {
    top: max(12px, env(safe-area-inset-top));
  }

  :where(.metric-grid, .patient-rail-list) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phone: a single content column, safe-area-aware chrome, readable controls,
   and dialogs that remain usable above short mobile browser viewports. */
@media (max-width: 768px) {
  :root {
    --adaptive-page-gutter: clamp(10px, 3.8vw, 16px);
    --adaptive-section-gap: 12px;
  }

  .auth-screen {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .auth-layout {
    width: 100%;
    margin-inline: auto;
  }

  .app-shell {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .sidebar {
    top: max(8px, env(safe-area-inset-top));
    width: 100%;
    margin-inline: 0;
  }

  .main-content {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .content-header h1 {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
  }

  :where(
    .form-grid,
    .exercise-form,
    .filter-row,
    .history-filter-row,
    .ta-section-grid,
    .readonly-history-meta-grid,
    .registration-layout,
    .registration-form,
    .account-directory-filters,
    .daily-patient-assignment-toolbar,
    .care-team-appointment-form
  ) {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(.workspace-tabs, .access-tabs) {
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  :where(.workspace-tabs, .access-tabs) > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    max-width: 100%;
    font-size: 16px;
  }

  .modal-backdrop:not(.patient-experience-backdrop) {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .modal-backdrop:not(.patient-experience-backdrop) > .modal-card {
    width: 100%;
    max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
  }
}

@media (max-width: 520px) {
  .sidebar-brand-copy small {
    display: none;
  }

  :where(.modal-actions, .portal-dialog-actions) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  :where(.modal-actions, .portal-dialog-actions) > button {
    width: 100%;
  }

  .patient-note-symptom-choice,
  .patient-note-symptom-choice strong {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .sidebar {
    padding-inline: 10px;
  }

  .content-header h1 {
    font-size: 1.15rem;
  }

  .patient-note-page-marker {
    gap: 4px;
  }
}

@media (hover: none) and (pointer: coarse) {
  :where(
    button,
    summary,
    select,
    input:not([type="checkbox"]):not([type="radio"]),
    .workspace-tab,
    .nav-btn
  ) {
    min-height: 44px;
  }
}

@media (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
  .app-shell {
    padding: 8px;
  }

  .sidebar {
    top: 8px;
    min-height: 56px;
    padding-block: 8px;
  }

  .content-area {
    margin-top: 8px;
  }

  .content-header {
    min-height: 60px;
    padding-block: 10px;
  }
}

/* ========================================================================== */
/* Mobile Patient List readability — scoped presentation fix                   */
/* ========================================================================== */
@media (max-width: 600px) {
  /* The legacy mobile action rule gave the ellipsis menu a 140px flex-basis,
     stretching the patient identity card into a large empty block. */
  #mainContent[data-view="patients"] .patient-detail-header {
    min-height: 0;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 14px;
  }

  #mainContent[data-view="patients"] .patient-detail-identity {
    flex: 1 1 auto;
    align-items: flex-start;
    gap: 10px;
  }

  #mainContent[data-view="patients"] .patient-detail-actions {
    width: auto;
    flex: 0 0 auto;
    align-items: flex-start;
    flex-direction: row;
    justify-content: flex-end;
    margin-left: auto;
  }

  #mainContent[data-view="patients"] .patient-detail-actions > * {
    width: auto;
    flex: 0 0 auto;
  }

  #mainContent[data-view="patients"] .patient-detail-meta {
    gap: 6px;
    margin-top: 5px;
  }

  /* Desktop's animated horizontal tab rail is too dense for a phone. Keep the
     same buttons/actions, but present them as a stable two-column mobile grid. */
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
    margin: 6px 8px 8px;
    padding: 6px;
    overflow: visible;
    border: 0;
    border-radius: 14px;
    background: rgba(226, 244, 250, 0.72);
    scrollbar-width: none;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs::-webkit-scrollbar {
    display: none;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs .motion-selection-indicator {
    display: none !important;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: flex-start;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid rgba(7, 88, 166, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink-soft);
    font-size: 0.69rem;
    line-height: 1.22;
    text-align: left;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab .tab-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs.motion-shared-selection > .workspace-tab.active,
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab.active {
    border-color: transparent;
    background: linear-gradient(135deg, rgba(12, 181, 203, 0.96), rgba(8, 125, 159, 0.98)) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(7, 83, 125, 0.14) !important;
  }

  #mainContent[data-view="patients"] .patient-tab-panel {
    padding: 12px;
  }
}

@media (max-width: 380px) {
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* ========================================================================== */
/* v39 compact-desktop typography and Patient List tab fit                    */
/* ========================================================================== */
@media (min-width: 901px) and (max-width: 1440px) {
  html { font-size: 15px; }

  /* Keep navigation labels intact: shrink type slightly and let the rail
     scroll instead of allowing one tab's text to paint over its neighbor. */
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs,
  #mainContent[data-view="access"] .access-tabs {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab,
  #mainContent[data-view="access"] .access-tabs > .workspace-tab {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: none !important;
    padding: 6px 8px !important;
    gap: 4px !important;
    font-size: .68rem !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs .tab-icon,
  #mainContent[data-view="access"] .access-tabs .tab-icon {
    width: 14px !important;
    height: 14px !important;
    flex: 0 0 14px !important;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  html { font-size: 14px; }
  body, button, input, select, textarea { font-size: .95rem; }
  .content-header h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); }
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab,
  #mainContent[data-view="access"] .access-tabs > .workspace-tab {
    font-size: .64rem !important;
    padding-inline: 7px !important;
  }
}

/* ========================================================================== */
/* v40 patient-record tabs: size to the detail pane, not the browser viewport */
/* ========================================================================== */
/* A wide browser can still leave the Patient Record pane narrow because the
   sidebar and patient directory consume part of the page. The previous
   viewport-only breakpoint therefore missed the exact smaller-desktop layout
   shown in production. Let the tab rail adapt to its OWN available width.
   Full-size desktop remains a single row whenever all seven tabs fit. */
@media (min-width: 769px) {
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    align-items: stretch !important;
    gap: 6px !important;
    overflow: visible !important;
    padding: 6px 8px !important;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 38px !important;
    justify-content: flex-start !important;
    padding: 7px 10px !important;
    gap: 6px !important;
    font-size: clamp(.68rem, .72vw, .82rem) !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* The moving pill is built for a single horizontal rail. Wrapped desktop
     rows use the existing active-tab surface instead so no indicator can land
     over another row after a resize. */
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .motion-selection-indicator {
    display: none !important;
  }

  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs.motion-shared-selection > .workspace-tab.active,
  #mainContent[data-view="patients"] .patient-detail-pane > .workspace-tabs > .workspace-tab.active {
    background: linear-gradient(135deg, rgba(12, 181, 203, 0.96), rgba(8, 125, 159, 0.98)) !important;
    color: #fff !important;
    box-shadow:
      0 5px 12px rgba(7, 83, 125, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.32) !important;
  }
}

/* Reduce the root type scale on smaller desktop-class viewports. This keeps
   the whole workspace proportionate without changing mobile typography. */
@media (min-width: 769px) and (max-width: 1920px) {
  html { font-size: 15px; }
}

@media (min-width: 769px) and (max-width: 1440px) {
  html { font-size: 14px; }
}

/* ========================================================================== */
/* v43 Access Control tabs mirror Patient List responsive tab presentation     */
/* ========================================================================== */
@media (max-width: 600px) {
  #mainContent[data-view="access"] .access-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 6px !important;
    margin: 6px 8px 8px !important;
    padding: 6px !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: rgba(226, 244, 250, 0.72) !important;
    scrollbar-width: none;
  }

  #mainContent[data-view="access"] .access-tabs::-webkit-scrollbar {
    display: none;
  }

  #mainContent[data-view="access"] .access-tabs > .motion-selection-indicator {
    display: none !important;
  }

  #mainContent[data-view="access"] .access-tabs > .workspace-tab {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 44px !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    padding: 8px 10px !important;
    border: 1px solid rgba(7, 88, 166, 0.16) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.78) !important;
    color: var(--ink-soft) !important;
    font-size: 0.69rem !important;
    line-height: 1.22 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  #mainContent[data-view="access"] .access-tabs > .workspace-tab .tab-icon {
    width: 15px !important;
    height: 15px !important;
    flex: 0 0 15px !important;
  }

  #mainContent[data-view="access"] .access-tabs.motion-shared-selection > .workspace-tab.active,
  #mainContent[data-view="access"] .access-tabs > .workspace-tab.active {
    border-color: transparent !important;
    background: linear-gradient(135deg, rgba(12, 181, 203, 0.96), rgba(8, 125, 159, 0.98)) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(7, 83, 125, 0.14) !important;
  }
}

@media (max-width: 380px) {
  #mainContent[data-view="access"] .access-tabs {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (min-width: 769px) {
  /* Match the Patient List v40 container-aware desktop treatment. */
  #mainContent[data-view="access"] .access-tabs {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    align-items: stretch !important;
    gap: 6px !important;
    overflow: visible !important;
    padding: 6px 8px !important;
  }

  #mainContent[data-view="access"] .access-tabs > .workspace-tab {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 38px !important;
    justify-content: flex-start !important;
    padding: 7px 10px !important;
    gap: 6px !important;
    font-size: clamp(.68rem, .72vw, .82rem) !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #mainContent[data-view="access"] .access-tabs > .motion-selection-indicator {
    display: none !important;
  }

  #mainContent[data-view="access"] .access-tabs.motion-shared-selection > .workspace-tab.active,
  #mainContent[data-view="access"] .access-tabs > .workspace-tab.active {
    background: linear-gradient(135deg, rgba(12, 181, 203, 0.96), rgba(8, 125, 159, 0.98)) !important;
    color: #fff !important;
    box-shadow:
      0 5px 12px rgba(7, 83, 125, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.32) !important;
  }
}

/* ========================================================================== */
/* v54 patient exercise viewport: compact chrome + full remaining game surface */
/* ========================================================================== */
.patient-experience-active > .experience-live-header,
.patient-experience-breathing > .experience-live-header {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(8px, 1.4vw, 16px);
  min-height: 60px;
  padding: max(9px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 9px max(14px, env(safe-area-inset-left));
}

.experience-live-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.patient-experience-active .experience-completion-hint,
.patient-experience-breathing .experience-completion-hint {
  display: none !important;
}

.experience-language-control {
  display: inline-flex;
  min-width: 0;
  height: 36px;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-inset);
  color: var(--ink-strong);
}

.experience-language-icon {
  flex: 0 0 auto;
  font-size: 0.82rem;
  line-height: 1;
}

.experience-language-control select {
  width: auto;
  max-width: 92px;
  min-width: 50px;
  height: 30px;
  padding: 0 16px 0 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.73rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.patient-experience-active .experience-live-clock {
  min-width: 78px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-inset);
  font-size: clamp(0.92rem, 1.9vw, 1.12rem);
}

.patient-experience-active > .experience-game-stage,
.patient-experience-breathing > .experience-game-stage,
.patient-experience-active > .experience-game-stage > .experience-game-frame,
.patient-experience-breathing > .experience-game-stage > .experience-game-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 760px) {
  .patient-experience-active > .experience-live-header,
  .patient-experience-breathing > .experience-live-header,
  .patient-experience-active.is-video-exercise > .experience-live-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    min-height: 52px;
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  }

  .experience-live-title { gap: 7px; }
  .experience-live-title > div > span { font-size: 0.6rem; line-height: 1.05; }
  .experience-live-title strong { font-size: clamp(0.72rem, 3.45vw, 0.88rem); line-height: 1.08; }
  .experience-live-title .live-status-dot { flex-basis: 7px; width: 7px; height: 7px; }

  .experience-live-controls { gap: 5px; }
  .patient-experience-active .experience-live-clock,
  .patient-experience-active.is-video-exercise .experience-live-clock {
    min-width: 64px;
    padding: 4px 7px;
    font-size: clamp(0.78rem, 3.4vw, 0.92rem);
  }

  .experience-language-control {
    height: 32px;
    gap: 2px;
    padding: 0 5px;
  }
  .experience-language-icon { font-size: 0.72rem; }
  .experience-language-control select {
    max-width: 66px;
    min-width: 42px;
    height: 28px;
    padding-right: 12px;
    font-size: 0.66rem;
  }

  .breathing-header-icon {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .breathing-header-icon svg { width: 18px; }
  .breathing-duration-chip {
    padding: 5px 7px;
    font-size: 0.64rem;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .experience-live-title > div > span { display: none; }
  .experience-live-title strong { font-size: clamp(0.7rem, 3.7vw, 0.82rem); }
  .experience-language-control select { max-width: 58px; min-width: 38px; font-size: 0.62rem; }
  .patient-experience-active .experience-live-clock { min-width: 59px; padding-inline: 6px; }
  .breathing-duration-chip { display: none; }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .patient-experience-active > .experience-live-header,
  .patient-experience-breathing > .experience-live-header,
  .patient-experience-active.is-video-exercise > .experience-live-header {
    min-height: 44px;
    padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left));
  }
  .experience-live-title > div > span { display: none; }
  .experience-language-control { height: 30px; }
  .patient-experience-active .experience-live-clock { height: 30px; padding-block: 3px; }
}

/* ========================================================================== */
/* v64 patient exercise language control — globe + selected language only     */
/* ========================================================================== */
.experience-language-control {
  position: relative;
  display: inline-grid;
  grid-template-columns: 20px minmax(58px, auto) 10px;
  min-width: 0;
  height: 38px;
  align-items: center;
  column-gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(8, 125, 159, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 10px rgba(21, 74, 98, 0.07);
  color: var(--ink-strong);
  overflow: hidden;
}
.experience-language-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #087d9f;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.experience-language-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.experience-language-label {
  display: none !important;
}
.experience-language-control select {
  position: relative;
  z-index: 2;
  width: auto;
  min-width: 58px;
  max-width: 96px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink-strong);
  font: inherit;
  font-size: .74rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.experience-language-caret {
  position: relative;
  z-index: 1;
  margin-top: -2px;
  color: #087d9f;
  font-size: .76rem;
  font-weight: 900;
  pointer-events: none;
}
.experience-language-control:focus-within {
  border-color: rgba(8, 125, 159, .52);
  box-shadow: 0 0 0 3px rgba(12, 181, 203, .11), 0 3px 10px rgba(21, 74, 98, .07);
}
@media (max-width: 760px) {
  .experience-language-control {
    grid-template-columns: 18px minmax(52px, auto) 9px;
    height: 32px;
    padding: 0 7px;
    column-gap: 4px;
  }
  .experience-language-icon {
    width: 18px;
    height: 18px;
  }
  .experience-language-icon svg {
    width: 13px;
    height: 13px;
  }
  .experience-language-control select {
    min-width: 52px;
    max-width: 82px;
    height: 28px;
    font-size: .67rem;
    font-weight: 800;
  }
  .experience-language-caret {
    font-size: .66rem;
  }
}
@media (max-width: 390px) {
  .experience-language-control {
    grid-template-columns: 17px minmax(50px, auto) 8px;
    padding-inline: 6px;
    column-gap: 3px;
  }
  .experience-language-icon {
    width: 17px;
    height: 17px;
  }
  .experience-language-control select {
    min-width: 50px;
    max-width: 78px;
    font-size: .65rem;
  }
}


@media (max-width: 760px) {
  .balance-handoff-link-option { grid-template-columns: 30px minmax(0, 1fr); padding: 13px; }
  .balance-handoff-phone-link { font-size: 0.64rem; }
}

/* ========================================================================== */
/* v65 patient exercise language control — full label width + true centering   */
/* ========================================================================== */
.experience-language-control {
  display: inline-flex;
  width: 132px;
  min-width: 132px;
  height: 38px;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 10px;
}
.experience-language-icon,
.experience-language-caret {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  align-self: center;
  margin: 0;
  line-height: 1;
}
.experience-language-icon {
  width: 20px;
  height: 20px;
}
.experience-language-control select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
  line-height: normal;
  align-self: stretch;
  text-overflow: clip;
}
.experience-language-caret {
  width: 10px;
  height: 20px;
  margin-top: 0;
}

@media (max-width: 760px) {
  .experience-language-control {
    width: 116px;
    min-width: 116px;
    height: 32px;
    gap: 4px;
    padding: 0 7px;
  }
  .experience-language-icon {
    width: 18px;
    height: 18px;
  }
  .experience-language-control select {
    min-width: 0;
    max-width: none;
    height: 100%;
    font-size: .67rem;
  }
  .experience-language-caret {
    width: 9px;
    height: 18px;
    font-size: .66rem;
  }
}

@media (max-width: 390px) {
  .experience-language-control {
    width: 112px;
    min-width: 112px;
    gap: 3px;
    padding-inline: 6px;
  }
  .experience-language-icon {
    width: 17px;
    height: 17px;
  }
  .experience-language-control select {
    min-width: 0;
    max-width: none;
    font-size: .65rem;
  }
  .experience-language-caret {
    width: 8px;
    height: 17px;
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .experience-language-control {
    height: 30px;
  }
}


/* ========================================================================== */
/* v66 patient exercise language control — visible value is not native-select */
/* ========================================================================== */
.experience-language-control {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 136px;
  min-width: 136px;
  height: 38px;
  padding: 0 10px;
  box-sizing: border-box;
}
.experience-language-icon,
.experience-language-value,
.experience-language-caret {
  align-self: center;
  margin: 0;
}
.experience-language-icon,
.experience-language-caret {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.experience-language-value {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  height: 20px;
  align-items: center;
  white-space: nowrap;
  overflow: visible;
  color: var(--ink-strong);
  font-size: .74rem;
  font-weight: 800;
  line-height: 20px;
  pointer-events: none;
}
.experience-language-control select {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.experience-language-caret {
  width: 10px;
  height: 20px;
  line-height: 20px;
}
@media (max-width: 760px) {
  .experience-language-control {
    width: 122px;
    min-width: 122px;
    height: 32px;
    gap: 4px;
    padding: 0 7px;
  }
  .experience-language-value {
    height: 18px;
    font-size: .67rem;
    line-height: 18px;
  }
  .experience-language-caret {
    width: 9px;
    height: 18px;
    line-height: 18px;
    font-size: .66rem;
  }
}
@media (max-width: 390px) {
  .experience-language-control {
    width: 120px;
    min-width: 120px;
    gap: 3px;
    padding-inline: 6px;
  }
  .experience-language-value {
    font-size: .65rem;
  }
  .experience-language-caret {
    width: 8px;
  }
}
