:root {
  --gold: #c9a227;
  --primary-gold: #c9a227;
  --deep-gold: #a67c00;
  --soft-gold: #e8d8a8;
  --light-gold: #fff8e6;
  --bg: #ffffff;
  --bg-soft: #faf8f3;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e5e0d3;
  --green: #198754;
  --red: #dc3545;
  --warning: #b7791f;
  --highlight-bg: #fff4db;
  --highlight-bg-hover: #ffedc2;
  --highlight-border: #f5d89a;
  --highlight-border-strong: #e3b54b;
  --highlight-text: #7a4f08;
  --highlight-radius: 12px;
  --highlight-padding-y: 8px;
  --highlight-padding-x: 12px;
  --highlight-focus-ring: rgba(245, 184, 75, .22);
}

* { box-sizing: border-box; letter-spacing: 0; }
body {
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, #fff 0%, var(--bg-soft) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 0;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, .16);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: stretch;
}
.auth-card.single { width: min(560px, 100%); grid-template-columns: 1fr; }
.auth-brand, .panel, .card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(31, 41, 51, .08);
}
.auth-brand { padding: 36px; background: var(--bg-soft); }
.auth-brand h1 { margin: 18px 0 0; font-size: clamp(34px, 5vw, 58px); line-height: .98; font-family: Georgia, serif; font-weight: 500; }
.auth-brand p, .muted { color: var(--muted); line-height: 1.65; }
.panel { padding: 28px; }
.portal-page {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 44px);
  background:
    linear-gradient(135deg, rgba(255, 248, 230, .84), rgba(255, 255, 255, .94) 42%, rgba(250, 248, 243, .96)),
    radial-gradient(circle at top right, rgba(201, 162, 39, .16), transparent 32%);
}
.portal-hero {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 24px;
}
.portal-brand {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 24px 80px rgba(31, 41, 51, .08);
}
.portal-wordmark {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 14px 18px;
  border: 1px solid var(--soft-gold);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff, var(--light-gold));
  color: var(--deep-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}
.portal-brand h1 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
  font-family: Georgia, serif;
  font-weight: 500;
}
.portal-brand p:last-child {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.portal-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 22px;
  align-items: start;
}
.role-panel, .login-panel {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 24px 80px rgba(31, 41, 51, .08);
}
.role-panel { padding: 24px; }
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.role-card {
  min-height: 178px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  transition: .18s ease;
}
.role-card:hover, .role-card.active {
  transform: translateY(-2px);
  border-color: var(--soft-gold);
  background: linear-gradient(180deg, #fff, var(--light-gold));
  box-shadow: 0 18px 50px rgba(166, 124, 0, .1);
}
.role-icon {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: var(--light-gold);
  color: var(--deep-gold);
  border: 1px solid var(--soft-gold);
  font-weight: 900;
}
.role-card strong { font-size: 18px; }
.role-card small {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}
.role-cta {
  margin-top: auto;
  color: var(--deep-gold);
  font-weight: 900;
  font-size: 13px;
}
.client-portal-callout,
.client-login-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--soft-gold);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, var(--light-gold));
}
.client-portal-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.client-portal-callout h3,
.client-login-card strong {
  display: block;
  margin: 6px 0;
  font-size: 18px;
}
.client-portal-callout p:last-child,
.client-login-card small {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}
.client-login-card {
  display: grid;
  gap: 10px;
}
.client-login-card .btn {
  margin-top: 8px;
  width: fit-content;
}
.login-panel {
  position: sticky;
  top: 22px;
}
.login-panel h2 { margin: 8px 0 10px; }
.login-panel .btn:disabled {
  cursor: wait;
  opacity: .75;
}
.login-flow-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.login-flow-form + .login-flow-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.code-form {
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, rgba(255, 248, 230, .48));
}
.btn.full {
  width: 100%;
  justify-content: center;
}
.client-access-page {
  display: grid;
  place-items: center;
  padding: clamp(22px, 5vw, 64px);
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,248,230,.74) 52%, rgba(250,248,243,.98)),
    radial-gradient(circle at 50% 0%, rgba(201,162,39,.18), transparent 34%);
}
.client-access-shell {
  width: min(1200px, 100%);
  display: grid;
  gap: 22px;
  justify-items: center;
}
.client-access-brand {
  width: 100%;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.client-access-brand .portal-wordmark { display: none; }
.client-access-brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(42px, 8vw, 72px);
  line-height: .96;
  color: var(--text);
}
.client-access-brand p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  font-size: 16px;
}
.client-access-card {
  width: min(620px, 100%);
  position: relative;
  top: auto;
  overflow: hidden;
  padding: clamp(24px, 5vw, 38px);
  border-color: var(--soft-gold);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(31, 41, 51, .11);
}
.gold-rule {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--soft-gold), var(--gold), var(--deep-gold), var(--soft-gold));
}
.client-access-card h2 {
  margin: 8px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 500;
}
.client-trust-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.client-trust-points span {
  min-height: 58px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  border: 1px solid var(--soft-gold);
  border-radius: 14px;
  background: var(--light-gold);
  color: var(--deep-gold);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 900;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 94px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(201, 162, 39, .18);
  background: linear-gradient(180deg, #fff 0%, rgba(255, 248, 230, .58) 100%);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--soft-gold), var(--deep-gold));
}
.brand-wordmark strong {
  display: block;
  color: var(--deep-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: .04em;
}
.brand span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 310px minmax(0, 1fr); }
.sidebar {
  background: rgba(255, 255, 255, .98);
  border-right: 1px solid rgba(201, 162, 39, .18);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 18px 0 50px rgba(31, 41, 51, .06);
}
.sidebar nav { display: grid; gap: 10px; padding: 16px; }
.nav-item {
  min-height: 44px;
  display: flex; align-items: center;
  padding: 0 14px;
  border-left: 4px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.nav-item:hover, .nav-item.active {
  background: var(--light-gold);
  color: var(--deep-gold);
  border-left-color: var(--gold);
}
.nav-group {
  border: 1px solid rgba(232, 216, 168, .72);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(31, 41, 51, .045);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.nav-group:hover,
.nav-group[open] {
  border-color: rgba(201, 162, 39, .48);
  background: linear-gradient(180deg, #fff, rgba(255, 248, 230, .5));
  box-shadow: 0 16px 42px rgba(166, 124, 0, .08);
}
.nav-group summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px 0 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  list-style: none;
  user-select: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-summary-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(201, 162, 39, .3);
  border-radius: 12px;
  background: var(--light-gold);
  color: var(--deep-gold);
  font-size: 12px;
  font-weight: 900;
}
.nav-group summary::after {
  content: "▾";
  font-size: 12px;
  transition: transform .18s ease;
  color: var(--deep-gold);
}
.nav-group[open] summary::after { transform: rotate(180deg); }
.nav-group-items {
  display: grid;
  gap: 6px;
  padding: 0 10px 12px 56px;
}
.nav-subitem {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-left: 3px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.nav-subitem:hover, .nav-subitem.active {
  background: #fff;
  color: var(--deep-gold);
  border-left-color: var(--gold);
  box-shadow: 0 10px 24px rgba(31, 41, 51, .06);
  transform: translateX(2px);
}
.nav-subitem.active {
  background: var(--light-gold);
  font-weight: 900;
}
.content { min-width: 0; padding: 24px; }
.topbar {
  min-height: 82px;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  margin-bottom: 22px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 41, 51, .05);
}
.topbar h1 { margin: 4px 0 0; font-size: 26px; }
.eyebrow { margin: 0; color: var(--deep-gold); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.profile-pill {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 14px;
  font-weight: 700;
}
.profile-pill a { color: var(--deep-gold); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { padding: 22px; }
.card:hover { border-color: var(--soft-gold); }
.card.active-card {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fff, var(--light-gold));
  box-shadow: 0 18px 50px rgba(166, 124, 0, .12);
}
.stat strong { display: block; margin-top: 8px; font-size: 32px; }
.stat span { color: var(--muted); font-size: 14px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 24px 0 14px; }
.section-title h2 { margin: 0; font-size: 22px; }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 190px; }

.btn {
  min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--gold);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: .18s ease;
}
.btn:hover { background: var(--deep-gold); border-color: var(--deep-gold); }
.btn.secondary { background: #fff; color: var(--deep-gold); border-color: var(--soft-gold); }
.btn.secondary:hover { background: var(--light-gold); color: var(--deep-gold); }
.btn.danger { background: var(--red); border-color: var(--red); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 18px; background: #fff; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 820px; font-size: 14px; }
th { background: var(--bg-soft); color: var(--muted); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
th, td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
tr:hover td { background: var(--light-gold); }
.no-col { width: 64px; text-align: center; white-space: nowrap; }
.profile-detail-table {
  min-width: 0;
  table-layout: fixed;
}
.profile-list-view .profile-detail-table {
  width: 100%;
}
.profile-detail-table th {
  width: 20%;
}
.profile-detail-table td {
  width: 80%;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.profile-list-view .profile-detail-table th {
  width: 20%;
  vertical-align: top;
}
.profile-list-view .profile-detail-table td {
  width: 80%;
  max-width: 0;
  white-space: normal;
  word-break: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.family-panel {
  margin: 12px 0 16px;
}
.family-panel .form-grid {
  margin-top: 14px;
}
.family-member-picker {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  padding: 14px;
  display: grid;
  gap: 10px;
}
.family-member-picker legend {
  color: var(--deep-gold);
  font-size: 13px;
  font-weight: 800;
  padding: 0 8px;
}
.family-member-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.action-dropdown {
  position: relative;
  display: inline-block;
  min-width: 118px;
}
.action-dropdown summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--soft-gold);
  border-radius: 12px;
  background: #fff;
  color: var(--deep-gold);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(31, 41, 51, .06);
}
.action-dropdown summary::-webkit-details-marker { display: none; }
.action-dropdown summary::after {
  content: "▾";
  font-size: 11px;
  line-height: 1;
}
.action-dropdown[open] summary {
  border-color: var(--gold);
  background: var(--light-gold);
}
.action-menu {
  position: absolute;
  right: 0;
  z-index: 30;
  min-width: 170px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--soft-gold);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(31, 41, 51, .16);
}
.action-menu a,
.action-menu button {
  width: 100%;
  display: block;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.action-menu a:hover,
.action-menu button:hover {
  background: var(--light-gold);
  color: var(--deep-gold);
}
.action-menu form { margin: 0; }
.action-menu .danger-link {
  color: var(--danger);
}
.action-menu .danger-link:hover {
  background: #fff1f1;
  color: #b42318;
}
.empty { text-align: center; color: var(--muted); padding: 28px; }
.badge {
  display: inline-flex; align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--soft-gold);
  font-size: 12px;
  font-weight: 800;
}
.badge-gold { background: var(--highlight-bg); color: var(--highlight-text); border-color: var(--highlight-border); }
.badge-superadmin { background: linear-gradient(135deg, var(--primary-gold, var(--gold, #c9a227)), var(--deep-gold, #a67c00)); color: #fff; border-color: var(--deep-gold, #a67c00); box-shadow: 0 10px 22px rgba(166, 124, 0, .18); }
.badge-green { background: #eaf7ef; color: var(--green); border-color: #bde7ca; }
.badge-red { background: #fdecee; color: var(--red); border-color: #f5c2c7; }
.badge-warning { background: var(--highlight-bg); color: var(--highlight-text); border-color: var(--highlight-border); }
.vip-deep { background: var(--deep-gold); color: #fff; border-color: var(--deep-gold); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.notice { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--soft-gold); background: var(--light-gold); color: var(--deep-gold); }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; font-weight: 800; }
.auth-links.left { justify-content: flex-start; margin-top: 20px; }
.auth-links a:not(.btn) { color: var(--deep-gold); }
.profile-grid { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 18px; align-items: start; }
.profile-card h2 { margin-top: 12px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 30px; font-weight: 900; background: linear-gradient(135deg, var(--gold), var(--deep-gold)); box-shadow: 0 16px 35px rgba(166,124,0,.18); }
dl { display: grid; gap: 10px; margin: 18px 0 0; }
dt { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
dd { margin: 0; color: var(--text); }
.roadmap { display: grid; gap: 12px; }
.roadmap-step { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.roadmap-number { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--light-gold); color: var(--deep-gold); font-weight: 900; border: 1px solid var(--soft-gold); }
.layer-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-soft); }
.layer-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--deep-gold); }
.layer-row { min-width: 0; display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.layer-check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 800; }
.layer-check input { width: 18px; min-height: 18px; accent-color: var(--gold); }
.layer-summary { margin: 14px 0; padding: 14px; border: 1px solid var(--soft-gold); border-radius: 16px; background: var(--light-gold); }
.layer-summary ul { margin: 8px 0 0; padding-left: 18px; color: var(--text); }
.layer-summary li { margin: 4px 0; }
.therapy-record-card { display: grid; gap: 16px; border-color: var(--soft-gold); }
.premium-therapy-record {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--soft-gold);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,248,243,.95)),
    radial-gradient(circle at 90% 0%, rgba(232,216,168,.28), transparent 34%);
  box-shadow: 0 24px 70px rgba(31, 41, 51, .08);
}
.premium-therapy-record::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--deep-gold), var(--gold), var(--soft-gold));
}
.therapy-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(232, 216, 168, .72);
}
.therapy-record-head h3 { margin: 8px 0 10px; font-size: 24px; }
.therapy-date {
  min-width: 160px;
  padding: 13px 14px;
  border: 1px solid var(--soft-gold);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf7, var(--light-gold));
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, .08);
}
.therapy-date span, .therapy-meta-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.therapy-date strong, .therapy-meta-grid strong {
  display: block;
  color: var(--text);
  overflow-wrap: anywhere;
}
.therapy-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.therapy-meta-grid div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.ipsc-layer-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}
.ipsc-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}
.ipsc-completed { background: #eaf7ef; color: var(--green); border-color: #bde7ca; }
.ipsc-upcoming { background: var(--light-gold); color: var(--deep-gold); border-color: var(--soft-gold); }
.ipsc-pending { background: #fff4db; color: var(--warning); border-color: #f5d89a; }
.ipsc-not-selected { background: #f4f4f2; color: var(--muted); border-color: var(--border); }
.print-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--soft-gold);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 41, 51, .05);
}
.print-toolbar h2 { margin: 4px 0 0; }
.paper-record-scroll {
  width: 100%;
  overflow-x: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f3efe5;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65);
}
.paper-record {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 18mm 16mm;
  background:
    linear-gradient(180deg, #fffdf8, #fffaf0),
    radial-gradient(circle at 92% 0%, rgba(232,216,168,.22), transparent 32%);
  color: #111;
  border: 1px solid #d7cdae;
  box-shadow: 0 24px 80px rgba(31, 41, 51, .14);
  font-family: Georgia, "Times New Roman", serif;
}
.paper-record-header {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 16px;
  text-align: center;
  border-bottom: 2px solid #c9a227;
  padding-bottom: 12px;
}
.paper-record h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .06em;
}
.paper-info-table,
.paper-main-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}
.paper-info-table { margin-bottom: 16px; }
.paper-info-table th,
.paper-info-table td,
.paper-main-table th,
.paper-main-table td {
  border: 1px solid #1d1d1d;
  padding: 8px 9px;
  color: #111;
  vertical-align: middle;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.35;
}
.paper-info-table th,
.paper-main-table th {
  background: #efe7d2;
  font-weight: 800;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
}
.paper-info-table td,
.paper-main-table td {
  background: #fff;
}
.paper-info-table th { width: 23%; }
.paper-info-table td { width: 27%; }
.paper-total-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 16px;
  border: 1px solid #1d1d1d;
  border-right: 0;
  font-family: Georgia, "Times New Roman", serif;
}
.paper-total-bottom { margin: 16px 0 0; }
.paper-total-grid div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 9px;
  border-right: 1px solid #1d1d1d;
  background: #fff;
  color: #111;
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.paper-total-grid span {
  font-weight: 800;
  color: #111;
}
.paper-total-grid strong {
  color: #111;
  font-size: 15px;
}

.ipsc-total-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 6px 12px;
  border: 1px solid var(--soft-gold);
  border-radius: 999px;
  background: var(--light-gold);
  color: var(--deep-gold);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.1), 0 4px 12px rgba(166, 124, 0, 0.08);
}
.paper-main-table th,
.paper-main-table td {
  min-height: 38px;
  text-align: center;
}
.paper-main-table thead th {
  min-height: 34px;
  font-size: 13px;
}
.paper-main-table td:nth-child(6) {
  text-align: left;
}
.paper-main-table th:first-child,
.paper-main-table td:first-child { width: 15%; }
.paper-main-table th:nth-child(2),
.paper-main-table td:nth-child(2),
.paper-main-table th:nth-child(3),
.paper-main-table td:nth-child(3),
.paper-main-table th:nth-child(4),
.paper-main-table td:nth-child(4) { width: 13%; }
.paper-main-table th:nth-child(2),
.paper-main-table td:nth-child(2),
.paper-main-table th:nth-child(3),
.paper-main-table td:nth-child(3),
.paper-main-table th:nth-child(4),
.paper-main-table td:nth-child(4) {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-size: 12px;
}
.paper-main-table th:nth-child(5),
.paper-main-table td:nth-child(5) { width: 19%; }
.paper-main-table th:nth-child(6),
.paper-main-table td:nth-child(6) { width: 27%; }
.client-profile-view { display: grid; gap: 18px; margin-bottom: 24px; }
.client-hero { position: relative; overflow: hidden; border-color: var(--soft-gold); }
.gold-line { position: absolute; inset: 0 auto 0 0; width: 6px; background: linear-gradient(180deg, var(--gold), var(--soft-gold), var(--deep-gold)); }
.client-hero-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding-left: 8px; }
.client-hero h2 { margin: 8px 0 10px; font-size: clamp(24px, 3vw, 30px); }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; }
.client-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.client-actions form { margin: 0; }
.hero-facts { margin-top: 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.client-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.premium-therapy-record .client-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ipsc-total-summary { margin: 14px 0 16px; }
.ipsc-total-bottom { margin: 18px 0 0; }
.summary-card {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--soft-gold);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, var(--bg-soft));
  box-shadow: 0 18px 46px rgba(31, 41, 51, .05);
}
.summary-card-total {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--light-gold), #fff);
  box-shadow: 0 20px 48px rgba(166, 124, 0, .12);
}
.summary-card-total strong {
  color: var(--deep-gold);
}
.premium-therapy-record .compact-table,
.premium-therapy-record > .table-wrap {
  border: 1px solid rgba(232, 216, 168, .85);
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.premium-therapy-record .compact-table table,
.premium-therapy-record > .table-wrap table {
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
}
.premium-therapy-record .compact-table th,
.premium-therapy-record > .table-wrap th {
  background: linear-gradient(180deg, #fff8e6, #f5ead0);
  color: var(--deep-gold);
  border-bottom: 1px solid var(--soft-gold);
  font-weight: 900;
  text-transform: none;
}
.premium-therapy-record .compact-table td,
.premium-therapy-record > .table-wrap td {
  background: #fff;
  border-bottom: 1px solid rgba(229, 224, 211, .82);
}
.premium-therapy-record .compact-table tr:hover td,
.premium-therapy-record > .table-wrap tr:hover td {
  background: #fffaf0;
}
.premium-therapy-record .compact-table th,
.premium-therapy-record .compact-table td,
.premium-therapy-record > .table-wrap th,
.premium-therapy-record > .table-wrap td {
  padding: 13px 12px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: normal;
  vertical-align: middle;
  line-height: 1.45;
}
.premium-therapy-record .compact-table th:nth-child(3),
.premium-therapy-record .compact-table td:nth-child(3),
.premium-therapy-record .compact-table th:nth-child(4),
.premium-therapy-record .compact-table td:nth-child(4),
.premium-therapy-record .compact-table th:nth-child(5),
.premium-therapy-record .compact-table td:nth-child(5),
.premium-therapy-record > .table-wrap th:nth-child(3),
.premium-therapy-record > .table-wrap td:nth-child(3),
.premium-therapy-record > .table-wrap th:nth-child(4),
.premium-therapy-record > .table-wrap td:nth-child(4),
.premium-therapy-record > .table-wrap th:nth-child(5),
.premium-therapy-record > .table-wrap td:nth-child(5) {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.premium-therapy-record .compact-table th:nth-child(8),
.premium-therapy-record .compact-table td:nth-child(8),
.premium-therapy-record .compact-table th:nth-child(10),
.premium-therapy-record .compact-table td:nth-child(10),
.premium-therapy-record > .table-wrap th:nth-child(8),
.premium-therapy-record > .table-wrap td:nth-child(8),
.premium-therapy-record > .table-wrap th:nth-child(10),
.premium-therapy-record > .table-wrap td:nth-child(10) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.summary-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.hero-facts div, .info-list div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.hero-facts span, .info-list span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.hero-facts strong, .info-list strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
.client-profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.profile-main-col { min-width: 0; display: grid; gap: 18px; }
.profile-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.info-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 41, 51, .05);
}
.info-card h3 { margin: 0 0 14px; font-size: 17px; }
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.info-list.compact, .info-list .wide { grid-template-columns: 1fr; }
.info-list .wide { grid-column: 1 / -1; }
.quick-summary { position: sticky; top: 20px; border-color: var(--soft-gold); background: linear-gradient(180deg, #fff, var(--bg-soft)); }
.profile-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}
.profile-tabs a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--deep-gold);
  background: var(--light-gold);
  border: 1px solid var(--soft-gold);
  font-size: 13px;
  font-weight: 900;
}
.pipeline-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.pipeline-col {
  min-height: 180px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, var(--bg-soft));
  box-shadow: 0 14px 38px rgba(31, 41, 51, .04);
}
.pipeline-col h3 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 14px;
}
.pipeline-col h3 span {
  min-width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--light-gold);
  color: var(--deep-gold);
  border: 1px solid var(--soft-gold);
}
.pipeline-card {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.pipeline-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.related-grid .full-width { grid-column: 1 / -1; }
.compact-table table { min-width: 1120px; font-size: 13px; table-layout: fixed; }
.compact-table th, .compact-table td { padding: 11px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; vertical-align: middle; }
.compact-table th:nth-child(3),
.compact-table td:nth-child(3),
.compact-table th:nth-child(4),
.compact-table td:nth-child(4),
.compact-table th:nth-child(5),
.compact-table td:nth-child(5) {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-size: 12px;
}
.record-line { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--border); }
.record-line:first-of-type { border-top: 0; padding-top: 0; }
.record-line span, .empty-state { color: var(--muted); line-height: 1.55; }
.empty-state { margin: 0; padding: 18px; border-radius: 14px; background: var(--bg-soft); border: 1px dashed var(--border); }

body.role-doctor .app-shell {
  grid-template-columns: 310px minmax(0, 1fr);
}
body.role-doctor .sidebar {
  width: 310px;
}
body.role-doctor .content {
  width: 100%;
  min-width: 0;
  padding: 24px;
}
body.role-doctor .topbar {
  width: 100%;
  min-height: 82px;
  margin: 0 0 22px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 41, 51, .05);
}
body.role-doctor .topbar h1 {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.2;
}
body.role-doctor .profile-pill {
  min-height: 38px;
  align-self: center;
}
body.role-doctor .content > .section-title,
body.role-doctor .therapy-clean-section .section-title {
  width: 100%;
  margin: 0 0 14px;
}
body.role-doctor .content > .section-title:not(:first-child),
body.role-doctor .therapy-clean-section .section-title:not(:first-child) {
  margin-top: 22px;
}
body.role-doctor .section-title h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}
body.role-doctor .section-title p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
body.role-doctor .info-card,
body.role-doctor .client-section,
body.role-doctor .client-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 41, 51, .05);
}
body.role-doctor .info-card,
body.role-doctor .client-section {
  width: 100%;
  padding: 20px;
}
body.role-doctor .info-card h3,
body.role-doctor .client-section-head h3 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.25;
}
body.role-doctor .client-section-head {
  margin-bottom: 14px;
}
body.role-doctor .table-wrap,
body.role-doctor .client-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
}
body.role-doctor .table-wrap table,
body.role-doctor .client-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}
body.role-doctor .table-wrap th,
body.role-doctor .table-wrap td,
body.role-doctor .client-table th,
body.role-doctor .client-table td {
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.45;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
body.role-doctor .table-wrap th,
body.role-doctor .client-table th {
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
}
body.role-doctor .table-wrap tr:hover td,
body.role-doctor .client-table tr:hover td {
  background: var(--light-gold);
}
body.role-doctor .btn,
body.role-doctor .client-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}
body.role-doctor .badge {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
body.role-doctor .client-profile-view {
  display: grid;
  gap: 18px;
}
body.role-doctor .therapy-clean-section {
  margin-top: 0;
}
body.role-doctor .therapy-clean-card {
  border-radius: 18px;
}
body.role-doctor .appointment-page-card {
  display: grid;
  gap: 14px;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid rgba(201, 162, 39, .18);
    box-shadow: 0 14px 34px rgba(31, 41, 51, .06);
  }
  .sidebar nav { grid-template-columns: 1fr; padding: 12px; }
  .brand { min-height: auto; padding: 16px; }
  .brand-wordmark strong { font-size: 22px; }
  .nav-group summary { min-height: 50px; font-size: 16px; }
  .nav-group-items { padding-left: 50px; }
  .nav-subitem { min-height: 42px; font-size: 15px; }
  .nav-subitem.bo-desktop-only[hidden] { display: none; }
  .auth-card, .portal-shell, .role-grid, .grid-2, .grid-3, .grid-4, .form-grid, .profile-grid, .client-profile-layout, .profile-card-grid, .related-grid, .hero-facts, .info-list, .therapy-meta-grid, .client-summary-grid { grid-template-columns: 1fr; }
  .portal-brand { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .client-trust-points { grid-template-columns: 1fr; }
  .portal-wordmark { width: 100%; max-width: 280px; }
  .content { padding: 14px; }
  body.role-doctor .app-shell { grid-template-columns: 1fr; }
  body.role-doctor .sidebar { width: 100%; }
  body.role-doctor .content { padding: 14px; }
  body.role-doctor .topbar { align-items: flex-start; flex-direction: column; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .layer-picker, .ipsc-layer-row { grid-template-columns: 1fr; }
  .layer-row { grid-template-columns: 1fr; }
  .filters input, .filters select { width: 100%; }
  .client-hero-main { flex-direction: column; }
  .therapy-record-head { flex-direction: column; }
  .therapy-date { width: 100%; }
  .print-toolbar { align-items: stretch; flex-direction: column; }
  .print-toolbar .actions, .print-toolbar .btn { width: 100%; }
  .client-portal-callout { align-items: stretch; flex-direction: column; }
  .client-portal-callout .btn, .client-login-card .btn { width: 100%; }
  .client-actions { justify-content: flex-start; width: 100%; }
  .client-actions .btn, .client-actions form, .client-actions form button { width: 100%; }
  .action-dropdown { min-width: 108px; }
  .action-menu {
    right: auto;
    left: 0;
    min-width: 160px;
  }
  .quick-summary { position: static; }
  .login-panel { position: static; }
  .portal-brand { grid-template-columns: 1fr; }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  html,
  body {
    width: 210mm;
    min-height: 297mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body * {
    visibility: hidden;
  }
  .paper-record,
  .paper-record * {
    visibility: visible;
  }
  .sidebar,
  .topbar,
  .print-toolbar,
  .section-title,
  .content > section:not(.print-toolbar),
  .content > .grid,
  .content > .notice,
  .therapy-record-card .actions {
    display: none !important;
  }
  .app-shell,
  .content,
  .paper-record-scroll {
    display: block !important;
    width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  .paper-record {
    position: absolute;
    inset: 0 auto auto 0;
    width: 210mm !important;
    min-height: 297mm !important;
    margin: 0 !important;
    padding: 18mm 16mm !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .paper-info-table th,
  .paper-info-table td,
  .paper-main-table th,
  .paper-main-table td {
    border-color: #000 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: anywhere !important;
    line-height: 1.3 !important;
  }
  .paper-info-table th,
  .paper-main-table th {
    background: #efe7d2 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .paper-total-grid {
    border-color: #000 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .paper-total-grid div {
    border-color: #000 !important;
  }
  .ipsc-total-badge {
    background: #fff8e6 !important;
    border-color: #a67c00 !important;
    color: #a67c00 !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .paper-main-table th:nth-child(2),
  .paper-main-table td:nth-child(2),
  .paper-main-table th:nth-child(3),
  .paper-main-table td:nth-child(3),
  .paper-main-table th:nth-child(4),
  .paper-main-table td:nth-child(4) {
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    font-size: 11px !important;
  }
}

.view-as-menu {
  display: grid;
  gap: 8px;
  margin: 14px 12px 0;
  padding: 12px;
  border: 1px solid var(--soft-gold);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, var(--light-gold));
}
.view-as-menu span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.view-as-menu a {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(232, 216, 168, .85);
  border-radius: 10px;
  color: var(--deep-gold);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}
.view-as-menu a:hover { background: var(--light-gold); }
.view-as-menu .exit-view-as {
  border-color: #f1b8b8;
  color: #b42318;
  background: #fff6f6;
}
.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid var(--gold);
  border-radius: 16px;
  background: linear-gradient(90deg, var(--light-gold), #fff);
  color: var(--deep-gold);
  box-shadow: 0 16px 40px rgba(166, 124, 0, .1);
}
.view-as-banner strong { font-size: 15px; }
.view-as-banner a {
  color: #b42318;
  font-weight: 900;
}

/* System-wide normal highlight standard. Red remains destructive/error, green remains success/completed. */
.ssc-highlight,
.nav-item:hover,
.nav-item.active,
.nav-subitem:hover,
.nav-subitem.active,
.nav-subitem.nav-single.active,
.client-tab.active,
.client-tab:hover,
.card.active-card,
.role-card:hover,
.role-card.active,
.view-as-menu a:hover,
.view-as-banner,
.notice,
.client-pill,
.profile-pill,
.client-status-badge,
.ipsc-pill,
.ipsc-upcoming,
.ipsc-pending,
.ipsc-total-badge,
.layer-summary,
.summary-label,
.info-badge,
.appointment-alert:not(.error),
.appointment-modal-message:not(.error),
.appointment-field-client,
.appointment-field-type,
.appointment-field-doctor,
.appointment-field-office,
.appointment-status-field .appointment-field-shell,
.appointment-arrival-field .appointment-field-shell,
.appointment-status-field[data-status-tone="blue"] .appointment-field-shell,
.appointment-arrival-field[data-status-tone="blue"] .appointment-field-shell,
.appointment-status-field[data-status-tone="orange"] .appointment-field-shell,
.appointment-arrival-field[data-status-tone="orange"] .appointment-field-shell,
.appointment-field-date,
.appointment-field-time,
.ipsc-layer-card,
.ipsc-layer-card-ectoderm,
.ipsc-layer-card-mesoderm,
.ipsc-layer-card-endoderm,
.ipsc-layer-name,
tr.highlight td,
tr.selected td,
tr.active td,
tr.table-highlight td,
tr:hover td {
  background: var(--highlight-bg) !important;
  border-color: var(--highlight-border) !important;
  color: var(--highlight-text) !important;
  border-radius: var(--highlight-radius);
}
.ssc-highlight,
.client-pill,
.profile-pill,
.client-status-badge,
.ipsc-pill,
.ipsc-total-badge,
.info-badge,
.summary-label {
  padding: var(--highlight-padding-y) var(--highlight-padding-x) !important;
}
.nav-item:hover,
.nav-item.active,
.nav-subitem:hover,
.nav-subitem.active,
.nav-subitem.nav-single.active,
.client-tab.active,
.client-tab:hover,
.view-as-menu a:hover,
.card.active-card,
.role-card:hover,
.role-card.active {
  box-shadow: 0 10px 24px rgba(122, 79, 8, .08) !important;
}
.nav-item.active,
.nav-subitem.active,
.nav-subitem.nav-single.active,
.client-tab.active {
  font-weight: 900 !important;
}
.ssc-editable-field,
input:not([type]):not([readonly]):not(:disabled),
input[type="text"]:not([readonly]):not(:disabled),
input[type="email"]:not([readonly]):not(:disabled),
input[type="tel"]:not([readonly]):not(:disabled),
input[type="number"]:not([readonly]):not(:disabled),
input[type="date"]:not([readonly]):not(:disabled),
input[type="time"]:not([readonly]):not(:disabled),
input[type="search"]:not([readonly]):not(:disabled),
input[type="password"]:not([readonly]):not(:disabled),
input[type="url"]:not([readonly]):not(:disabled),
select:not(:disabled),
textarea:not([readonly]):not(:disabled),
.client-input:not([readonly]):not(:disabled),
.client-select:not(:disabled),
.client-textarea:not([readonly]):not(:disabled) {
  background: var(--highlight-bg) !important;
  border-color: var(--highlight-border) !important;
  color: var(--highlight-text) !important;
}
.ssc-editable-field:hover,
input:not([type]):not([readonly]):not(:disabled):hover,
input[type="text"]:not([readonly]):not(:disabled):hover,
input[type="email"]:not([readonly]):not(:disabled):hover,
input[type="tel"]:not([readonly]):not(:disabled):hover,
input[type="number"]:not([readonly]):not(:disabled):hover,
input[type="date"]:not([readonly]):not(:disabled):hover,
input[type="time"]:not([readonly]):not(:disabled):hover,
input[type="search"]:not([readonly]):not(:disabled):hover,
input[type="password"]:not([readonly]):not(:disabled):hover,
input[type="url"]:not([readonly]):not(:disabled):hover,
select:not(:disabled):hover,
textarea:not([readonly]):not(:disabled):hover,
.client-input:not([readonly]):not(:disabled):hover,
.client-select:not(:disabled):hover,
.client-textarea:not([readonly]):not(:disabled):hover {
  background: var(--highlight-bg-hover) !important;
  border-color: var(--highlight-border) !important;
}
input[readonly],
textarea[readonly],
select[readonly],
input:disabled,
select:disabled,
textarea:disabled,
.client-input[readonly],
.client-input:disabled,
.client-select:disabled,
.client-textarea[readonly],
.client-textarea:disabled,
.appointment-field-shell input[readonly] {
  background: #f8f6f0 !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
  cursor: not-allowed;
}
input:focus,
select:focus,
textarea:focus,
.appointment-field-shell:focus-within,
.client-input:focus,
.client-select:focus,
.client-textarea:focus {
  border-color: var(--highlight-border-strong) !important;
  box-shadow: 0 0 0 3px var(--highlight-focus-ring) !important;
}
.badge:not(.badge-green):not(.badge-red):not(.badge-superadmin),
.badge-gold,
.badge-warning,
.client-status-badge:not(.status-blacklisted),
.appointment-status-field:not([data-status-tone="red"]):not([data-status-tone="green"]):not([data-status-tone="dark-green"]) .appointment-field-shell,
.appointment-arrival-field:not([data-status-tone="red"]):not([data-status-tone="green"]):not([data-status-tone="dark-green"]) .appointment-field-shell {
  background: var(--highlight-bg) !important;
  border-color: var(--highlight-border) !important;
  color: var(--highlight-text) !important;
}
.appointment-field-icon,
.role-icon,
.roadmap-number {
  background: rgba(255,255,255,.62) !important;
  border-color: var(--highlight-border) !important;
  color: var(--highlight-text) !important;
}
.badge-green,
.appointment-status-field[data-status-tone="green"] .appointment-field-shell,
.appointment-arrival-field[data-status-tone="green"] .appointment-field-shell,
.appointment-status-field[data-status-tone="dark-green"] .appointment-field-shell,
.appointment-arrival-field[data-status-tone="dark-green"] .appointment-field-shell,
.alert.success,
.client-alert.success {
  background: #eaf7ef !important;
  border-color: #bde7ca !important;
  color: var(--green) !important;
}
.badge-red,
.appointment-status-field[data-status-tone="red"] .appointment-field-shell,
.appointment-arrival-field[data-status-tone="red"] .appointment-field-shell,
.alert.error,
.client-alert.error,
.appointment-alert.error,
.appointment-modal-message.error,
.notice.error {
  background: #fdecee !important;
  border-color: #f5c2c7 !important;
  color: var(--red) !important;
}
.badge-superadmin {
  background: linear-gradient(135deg, var(--primary-gold, var(--gold, #c9a227)), var(--deep-gold, #a67c00)) !important;
  border-color: var(--deep-gold, #a67c00) !important;
  color: #fff !important;
}
.btn.secondary:hover,
.btn.secondary.active,
.action-menu a:hover,
.action-menu button:hover {
  background: var(--highlight-bg-hover) !important;
  border-color: var(--highlight-border-strong) !important;
  color: var(--highlight-text) !important;
}
@media (max-width: 900px) {
  .view-as-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-as-menu span { grid-column: 1 / -1; }
  .view-as-banner { align-items: flex-start; flex-direction: column; }
}

@media screen and (max-width: 900px) {
  .profile-detail-table, .profile-inline-edit-table, .therapy-detail-table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
    word-break: break-word;
  }
}

/* The desktop theme and its fonts are screen-only to preserve document output. */
@media (min-width: 901px) {
  @media screen {
    @font-face {
      font-family: "Inter";
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url("fonts/inter-latin-ext-400-normal.woff2") format("woff2");
      unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
    }

    @font-face {
      font-family: "Inter";
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
      unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
    }

    @font-face {
      font-family: "Inter";
      font-style: normal;
      font-weight: 500;
      font-display: swap;
      src: url("fonts/inter-latin-ext-500-normal.woff2") format("woff2");
      unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
    }

    @font-face {
      font-family: "Inter";
      font-style: normal;
      font-weight: 500;
      font-display: swap;
      src: url("fonts/inter-latin-500-normal.woff2") format("woff2");
      unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
    }

    @font-face {
      font-family: "Cormorant Garamond";
      font-style: normal;
      font-weight: 500;
      font-display: swap;
      src: url("fonts/cormorant-garamond-latin-ext-500-normal.woff2") format("woff2");
      unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
    }

    @font-face {
      font-family: "Cormorant Garamond";
      font-style: normal;
      font-weight: 500;
      font-display: swap;
      src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
      unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
    }

    :root {
      --danger: #8c3020;
      --red: var(--danger);
    }

    body[data-ui-lang] {
      --admin-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
      --admin-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
      --admin-canvas: #f8f5ef;
      --admin-ink: #1f1d1a;
      --admin-link: #75572c;
      --admin-nav: #6f685e;
      --admin-selected: #795e32;
      --admin-hover: #f8f2e7;
      --admin-primary: #2b241d;
      --admin-primary-hover: #44372a;
      --admin-secondary-border: #d9c4a0;
      --admin-surface-shadow: 0 10px 28px rgb(68 52 29 / 6%), 0 1px 2px rgb(68 52 29 / 4%);
      --admin-nav-shadow: 0 1px 2px #4632140a, 0 6px 18px #4632140d;
      --admin-gold-gradient: linear-gradient(160deg, #b8975c, #9e7e46);
      --admin-chip: #f7f1e7;
      --admin-chip-border: #e8dfcf;
      --admin-success: #eff2e9;
      --admin-success-border: #dce3d3;
      --admin-input: #f4efe7;
      --admin-input-border: #c4a870;
      --admin-focus: #a88956;
      --admin-ring: 0 0 0 4px #b793552e;
      --gold: #9e7e46;
      --primary-gold: #9e7e46;
      --deep-gold: #806332;
      --soft-gold: #e7dcc7;
      --light-gold: #f3eee5;
      --bg: #fffdfa;
      --bg-soft: #f3eee5;
      --text: #29231d;
      --muted: #70675d;
      --border: #e7dcc7;
      --green: #4b6244;
      --warning: #806332;
      --highlight-bg: var(--admin-chip);
      --highlight-bg-hover: var(--admin-hover);
      --highlight-border: var(--admin-chip-border);
      --highlight-border-strong: var(--admin-focus);
      --highlight-text: var(--deep-gold);
      --highlight-focus-ring: #b793552e;
      background: var(--admin-canvas);
      color: var(--admin-ink);
      font-family: var(--admin-font);
      font-size: 14px;
      font-weight: 400;
    }

    /* Preserve the paper preview's inherited defaults and global row-hover colour. */
    .paper-record-scroll {
      color: #1f2933;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    .paper-record-scroll,
    .paper-record {
      --border: #e5e0d3;
      --highlight-bg: #fff4db;
      --highlight-border: #f5d89a;
      --highlight-text: #7a4f08;
      font-size: 16px;
    }

    body[data-ui-lang] :is(.panel, .card, .topbar, .table-wrap, .client-section, .client-card,
      .office-section, .office-card, .staff-card, .settings-card, .enq-panel, .enq-card,
      .quote-panel, .tc-card, .tc-detail-hero, .tc-detail-section, .hr-sync-card, .info-card,
      .hero-fact, .related-card, .info-item, .summary-card, .therapy-record-card,
      .appointment-modal-panel, .doctor-modal-panel, .office-record-panel, .office-delete-panel,
      .program-modal-panel, .finance-modal-panel, .follow-modal-panel, .hr-review-panel,
      .inventory-modal-panel, .session-modal-panel, .enq-modal, .quote-modal, .therapy-link-panel,
      .client-confirm-dialog) {
      background: var(--bg);
      border-color: var(--border);
      border-radius: 17px;
      color: var(--text);
      box-shadow: var(--admin-surface-shadow);
    }

    body[data-ui-lang] .card.active-card {
      background: var(--bg) !important;
      border-color: var(--gold) !important;
      color: var(--text) !important;
      box-shadow: var(--admin-surface-shadow) !important;
    }

    body[data-ui-lang] .topbar h1 {
      color: var(--text);
      font-family: var(--admin-display);
      font-size: 36px;
      font-weight: 500;
    }

    body[data-ui-lang] :is(.content, .sidebar) h2:where(:not(
      :is(.paper-record, .therapy-print-sheet, .quote-page-a4, .invoice-print-page) *)),
    body[data-ui-lang] :is(.therapy-clean-section .section-title, #editEnquiryModal .enq-modal-head) h2 {
      color: var(--text);
      font-family: var(--admin-display);
      font-size: 30px;
      font-weight: 500;
    }

    body[data-ui-lang] .content h3:where(:not(
      :is(.paper-record, .therapy-print-sheet, .quote-page-a4, .invoice-print-page) *)),
    body[data-ui-lang] :is(.office-section-head, .therapy-clean-card, .invoice-editor-panel,
      .medical-profile-card, .client-confirm-dialog, .tc-detail-section-title) h3 {
      color: var(--text);
      font-family: var(--admin-display);
      font-size: 21px;
      font-weight: 500;
    }

    body[data-ui-lang] :is(.stat strong, .summary-card strong, .office-card .metric, .client-card .metric,
      .enq-stat strong, .client-vial-metric strong, .hr-sync-card strong, .tc-vials-total):where(
      :not(:is(.quote-page-a4, .invoice-print-page, .paper-record, .therapy-print-sheet) *)) {
      color: var(--text);
      font-family: var(--admin-display);
      font-size: clamp(32px, 2.6vw, 44px);
      font-weight: 500;
      font-variant-numeric: lining-nums tabular-nums;
    }

    body[data-ui-lang] :is(.eyebrow, .tc-detail-eyebrow, .view-as-menu span, .summary-label) {
      color: var(--muted);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: .13em;
      text-transform: uppercase;
    }

    body[data-ui-lang] :is(.muted, .stat span, .client-muted, .office-muted, .settings-hint,
      .therapy-field-note, .field-hint, .staff-title p, .enq-head p, .record-line span,
      .client-vial-metric span, .invoice-detail-item span, .client-document-unavailable,
      .family-group-member small) {
      color: var(--muted);
      font-size: 12px;
    }

    body[data-ui-lang] :is(.content, .sidebar) small:where(:not(
      :is(.paper-record, .therapy-print-sheet, .quote-page-a4, .invoice-print-page) *)) {
      font-size: 12px;
    }

    body[data-ui-lang] :is(label > span, dt, .client-label, .office-label, .enq-field label,
      .quote-field label, .staff-form-grid label, .doctor-form-grid label, .office-form-grid label,
      .settings-card label, .program-form-grid label, .invoice-editor-form label,
      .enq-edit-form .enq-field label) {
      color: var(--muted);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    body[data-ui-lang] dd:where(:not(.paper-record *)) {
      font-size: 13px;
      font-variant-numeric: tabular-nums;
    }

    body[data-ui-lang] table:where(:not(
      :is(.paper-record, .therapy-print-sheet, .quote-page-a4, .invoice-print-page) *,
          [class*="paper-"][class*="-table"], .invoice-print-table, .print-table)) {
      font-size: 13px;
      font-variant-numeric: tabular-nums;
    }

    body[data-ui-lang] :is(th, .permission-table th:first-child, .permission-table thead th):where(:not(
      :is(.paper-record, .therapy-print-sheet, .quote-page-a4, .invoice-print-page,
          [class*="paper-"][class*="-table"], .invoice-print-table, .print-table) *)) {
      background: var(--bg-soft);
      color: var(--muted);
      border-color: var(--border);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    body[data-ui-lang] tr:hover > td:where(:not(
      :is(.paper-record, .therapy-print-sheet, .quote-page-a4, .invoice-print-page,
          [class*="paper-"][class*="-table"], .invoice-print-table, .print-table) *)) {
      background: var(--admin-hover) !important;
      border-color: var(--border) !important;
      color: var(--text) !important;
    }

    body[data-ui-lang] .sidebar {
      background: var(--bg-soft);
      border-right: 1px solid #e7dfd2;
      box-shadow: var(--admin-nav-shadow);
    }

    body[data-ui-lang] .brand {
      background: var(--bg-soft);
      border-color: #e7dfd2;
    }

    body[data-ui-lang] .brand-wordmark strong {
      color: var(--deep-gold);
      font-family: var(--admin-display);
      font-weight: 500;
    }

    body[data-ui-lang] .nav-group {
      background: var(--bg);
      border-color: var(--border);
      box-shadow: var(--admin-nav-shadow);
    }

    body[data-ui-lang] :is(.nav-item, .nav-subitem, .nav-group summary) {
      color: var(--admin-nav);
      font-size: 15px;
      font-weight: 500;
    }

    body[data-ui-lang] :is(.nav-item, .nav-subitem):is(:hover, .active),
    body[data-ui-lang] .nav-subitem.nav-single.active,
    body[data-ui-lang] .nav-group > summary:hover {
      background: var(--bg) !important;
      color: var(--admin-selected) !important;
      border-color: transparent !important;
      box-shadow: var(--admin-nav-shadow) !important;
      font-weight: 500 !important;
    }

    body[data-ui-lang] .nav-icon {
      background: var(--bg-soft);
      color: var(--deep-gold);
      border-color: var(--border);
      font-weight: 500;
    }

    body[data-ui-lang] .nav-icon svg { color: var(--gold); }

    body[data-ui-lang] :is(.profile-tabs a, .client-tab, .office-tab, .therapy-tab, .wa-tabs a) {
      background: var(--bg-soft);
      color: var(--admin-nav);
      border-color: var(--border);
      font-size: 13px;
      font-weight: 500;
    }

    body[data-ui-lang] :is(.profile-tabs a, .client-tab, .office-tab, .therapy-tab, .wa-tabs a):is(.active, :hover) {
      background: var(--bg) !important;
      color: var(--admin-selected) !important;
      border-color: var(--border) !important;
      box-shadow: var(--admin-nav-shadow) !important;
      font-weight: 500 !important;
    }

    body[data-ui-lang] :is(.profile-pill, .view-as-menu, .view-as-banner, .quick-summary,
      .roadmap-step, .family-member-picker, .password-box, .office-assignment-box,
      .appointment-edit-section, .appointment-detail-item, .appointment-modal-head,
      .therapy-edit-section, .therapy-detail-summary, .therapy-detail-section, .therapy-layer-summary-card,
      .therapy-sop-card, .manual-batch-section, .manual-batch-layer, .enq-modal-head, .enq-modal-foot,
      .quote-box, .quote-side, .invoice-editor-section, .invoice-payment-panel, .invoice-detail-card,
      .client-verification-panel, .client-password-panel, .client-vial-metric) {
      background: var(--bg-soft);
      border-color: var(--border);
      color: var(--text);
      box-shadow: none;
    }

    body[data-ui-lang] :is(.profile-pill, .view-as-banner) {
      background: var(--bg-soft) !important;
      border-color: var(--border) !important;
      color: var(--text) !important;
    }

    body[data-ui-lang] :is(.content a:not([class]), .profile-pill a,
      .client-link, .office-link, .client-document-link, .office-link-button, .finance-invoice-link,
      .family-group-member a, .enq-text-action, .quote-no) {
      color: var(--admin-link);
    }

    body[data-ui-lang] :is(.avatar, .client-avatar) {
      background: #f5efe4;
      color: var(--deep-gold);
      border: 1px solid #e1d0ae;
      font-family: var(--admin-display);
      font-size: 27px;
      font-weight: 500;
      box-shadow: none;
    }

    body[data-ui-lang] :is(.btn, .client-btn, .office-btn, .enq-btn, .quote-btn, .action-dropdown summary,
      .staff-action-toggle, .client-account-menu summary, .client-action-mini) {
      border-radius: 11px;
      font-family: var(--admin-font);
      font-size: 13px;
      font-weight: 500;
    }

    body[data-ui-lang] :is(.btn:not(.secondary, .danger), .client-btn:not(.secondary, .danger),
      .office-btn:not(.secondary, .danger), .enq-btn.primary, .quote-btn.primary) {
      background: var(--admin-primary);
      border-color: var(--admin-primary-hover);
      color: var(--bg);
    }

    body[data-ui-lang] :is(.btn:not(.secondary, .danger), .client-btn:not(.secondary, .danger),
      .office-btn:not(.secondary, .danger), .enq-btn.primary, .quote-btn.primary):hover {
      background: var(--admin-primary-hover);
    }

    body[data-ui-lang] .client-back-arrow {
      background: var(--bg);
      border-color: var(--admin-secondary-border);
      border-radius: 11px;
      color: var(--admin-ink);
    }

    body[data-ui-lang] .client-back-arrow:hover {
      background: var(--admin-hover);
      border-color: var(--admin-secondary-border);
    }

    body[data-ui-lang] .client-table tbody td {
      border-color: var(--border);
    }

    body[data-ui-lang] .client-table tr:is(.client-row-male, .client-row-female) > td {
      background: var(--bg);
    }

    body[data-ui-lang] .client-table tr.client-family-member-row,
    body[data-ui-lang] .client-table tr.client-family-member-row:is(.client-row-male, .client-row-female) > td {
      background: var(--bg-soft);
    }

    body[data-ui-lang] .client-family-indent {
      border-color: var(--border);
    }

    body[data-ui-lang] :is(.client-title p, .client-section-head p, .client-sort-button, .client-pills) {
      color: var(--muted);
    }

    body[data-ui-lang] :is(.client-sort-arrow, .client-vials-count) {
      color: var(--deep-gold);
    }

    body[data-ui-lang] .client-family-count {
      background: var(--admin-chip);
      color: var(--deep-gold);
    }

    body[data-ui-lang] .client-table tr:is(.client-row-male, .client-row-female):hover > td {
      background: var(--admin-hover);
    }

    body[data-ui-lang] :is(.btn.secondary, .client-btn.secondary, .office-btn.secondary,
      .enq-btn:not(.primary, .danger), .quote-btn:not(.primary, .danger),
      .action-dropdown summary, .staff-action-toggle, .client-account-menu summary, .client-action-mini) {
      background: var(--bg);
      color: var(--admin-ink);
      border-color: var(--admin-secondary-border);
    }

    body[data-ui-lang] :is(.btn.secondary, .client-btn.secondary, .office-btn.secondary,
      .enq-btn:not(.primary, .danger), .quote-btn:not(.primary, .danger), .action-dropdown summary,
      .action-dropdown[open] summary, .staff-action-toggle, .client-account-menu summary,
      .client-action-mini):is(:hover, .active),
    body[data-ui-lang] :is(.action-dropdown[open], .client-account-menu[open]) summary {
      background: var(--admin-hover) !important;
      color: var(--admin-ink) !important;
      border-color: var(--admin-secondary-border) !important;
    }

    body[data-ui-lang] :is(.btn.danger, .client-btn.danger, .office-btn.danger, .enq-btn.danger,
      .quote-btn.danger) {
      background: var(--danger) !important;
      border-color: var(--danger) !important;
      color: var(--bg) !important;
    }

    body[data-ui-lang] :is(.action-menu, .staff-action-menu, .client-account-menu-panel,
      .quote-action-menu, .language-menu, .client-autocomplete-results, .office-autocomplete-results) {
      background: var(--bg);
      border-color: var(--border);
      box-shadow: var(--admin-surface-shadow);
    }

    body[data-ui-lang] :is(.action-menu, .staff-action-menu, .client-account-menu-panel) :is(a, button),
    body[data-ui-lang] :is(.language-selector, .quote-menu-item, .view-as-menu a) {
      font-size: 13px;
      font-weight: 500;
    }

    body[data-ui-lang] .view-as-menu a {
      border-color: var(--border);
    }

    body[data-ui-lang] :is(.action-menu, .staff-action-menu, .client-account-menu-panel,
      .client-autocomplete-results, .office-autocomplete-results) :is(a, button):hover,
    body[data-ui-lang] :is(.language-menu a:is(:hover, .active), .quote-menu-item:hover,
      .office-autocomplete-option:is(:hover, :focus), .client-autocomplete-option:is(:hover, :focus)) {
      background: var(--admin-hover) !important;
      color: var(--admin-link) !important;
    }

    body[data-ui-lang] .language-selector summary {
      background: var(--bg);
      border-color: var(--admin-secondary-border);
      color: var(--admin-ink);
    }

    body[data-ui-lang] .language-selector:is([open], :hover) summary {
      background: var(--admin-hover);
      border-color: var(--admin-secondary-border);
      color: var(--admin-ink);
    }

    body[data-ui-lang] :is(.badge, .office-pill, .enq-badge, .quote-status, .client-account-badge,
      .client-status-badge, .client-pill, .ipsc-pill, .info-badge, .payment-status-badge) {
      border-radius: 999px;
      font-size: 13px;
      font-weight: 400;
    }

    body[data-ui-lang] :is(.badge, .notice, .office-pill, .enq-badge, .quote-status, .enq-warning,
      .appointment-alert:not(.error), .appointment-modal-message:not(.error),
      .client-account-badge, .payment-status-badge, .therapy-vial-balance-badge.is-warning,
      .client-status-badge.status-potential, .client-therapy-status-badge:is(.status-pending, .status-overdue),
      .family-wallet-badge, .client-family-role, .ipsc-total-badge:not(.paper-record *)) {
      background: var(--admin-chip);
      border-color: var(--admin-chip-border);
      color: var(--deep-gold);
    }

    body[data-ui-lang] :is(.badge-green, .notice.success, .alert.success, .client-alert.success,
      .office-alert:not(.error), .client-verified-tick, .client-account-badge.account-active,
      .ipsc-completed, .client-status-badge.status-existing, .client-therapy-status-badge.status-completed,
      .enq-badge.converted, .enq-badge.converted-to-client, .enq-modal-message.success,
      .quote-status.converted, .payment-status-badge.status-paid, .payment-receipt-notice:not(.is-error),
      .appointment-status-field[data-status-tone="green"] .appointment-field-shell,
      .appointment-arrival-field[data-status-tone="green"] .appointment-field-shell,
      .appointment-status-field[data-status-tone="dark-green"] .appointment-field-shell,
      .appointment-arrival-field[data-status-tone="dark-green"] .appointment-field-shell) {
      background: var(--admin-success) !important;
      border-color: var(--admin-success-border) !important;
      color: var(--green) !important;
    }

    body[data-ui-lang] :is(.badge-red, .notice.error, .alert.error, .client-alert.error, .office-alert.error,
      .appointment-alert.error, .appointment-modal-message.error, .doctor-modal-message.error,
      .enq-modal-message.error, .hr-sync-note.error, .payment-receipt-notice.is-error,
      .client-status-badge.status-blacklisted, .client-therapy-status-badge.status-cancelled,
      .quote-status.cancelled, .enq-badge.cancelled-by-client, .payment-status-badge.status-void,
      .payment-status-badge.status-refunded, .client-account-badge.account-disabled,
      .appointment-status-field[data-status-tone="red"] .appointment-field-shell,
      .appointment-arrival-field[data-status-tone="red"] .appointment-field-shell,
      .view-as-menu .exit-view-as, .action-menu .danger-link:hover) {
      background: var(--admin-chip) !important;
      border-color: var(--admin-chip-border) !important;
      color: var(--danger) !important;
    }

    body[data-ui-lang] .badge.badge-grey:not(.badge-green, .badge-red, .badge-superadmin),
    body[data-ui-lang] :is(.info-badge, .enq-badge.closed, .ipsc-not-selected,
      .client-account-badge.account-not-activated, .client-status-badge:is(.status-kiv, .status-inactive, .status-deceased),
      .client-therapy-status-badge.status-scheduled) {
      background: var(--bg-soft) !important;
      border-color: var(--border) !important;
      color: var(--muted) !important;
    }

    body[data-ui-lang] .badge-superadmin {
      background: var(--admin-gold-gradient) !important;
      border-color: var(--gold) !important;
      color: var(--admin-ink) !important;
      box-shadow: var(--admin-nav-shadow);
    }

    body[data-ui-lang] .badge.vip-deep:not(.badge-green, .badge-red, .badge-superadmin) {
      background: var(--deep-gold) !important;
      border-color: var(--deep-gold) !important;
      color: var(--bg) !important;
    }

    body[data-ui-lang] :is(.view-as-banner a, .action-menu .danger-link, .quote-menu-item.danger,
      .therapy-date-error, .appointment-delete-confirm h4) {
      color: var(--danger);
    }

    body[data-ui-lang] :is(.appointment-field-icon, .roadmap-number, .invoice-editor-icon,
      .invoice-section-dot, .quote-side-icon) {
      background: var(--bg-soft) !important;
      border-color: var(--border) !important;
      color: var(--deep-gold) !important;
    }

    body[data-ui-lang] :is(.staff-profile-grid, .doctor-profile-grid, .hr-review-grid,
      .referral-profile-grid, .office-profile-grid, .office-view-grid, .finance-read-grid,
      .medical-profile-read-grid) div:nth-child(odd) {
      background: var(--bg-soft);
      border-color: var(--border);
    }

    body[data-ui-lang] .appointment-list-wrap .action-dropdown summary {
      background: var(--bg);
      color: var(--admin-ink);
      border-color: var(--admin-secondary-border);
    }

    body[data-ui-lang] :is(.appointment-form-actions, .doctor-modal-actions, .office-record-actions,
      .hr-review-actions, .office-delete-actions, .invoice-editor-footer, .quote-modal-footer,
      .settings-savebar, .client-account-menu-panel) {
      background: var(--bg);
      border-color: var(--border);
    }

    /* Editable and readonly controls share the same treatment across page modules. */
    body[data-ui-lang] :is(input:not([type="hidden"], [type="checkbox"], [type="radio"],
      [type="file"], [type="range"], [type="color"], [type="submit"], [type="button"], [type="reset"]),
      select, textarea, .ssc-editable-field):not([readonly], :disabled) {
      --highlight-bg: var(--admin-input);
      --highlight-bg-hover: var(--admin-input);
      --highlight-border: var(--admin-input-border);
      --highlight-text: var(--text);
      background: var(--admin-input) !important;
      border: 1px solid var(--admin-input-border) !important;
      border-radius: 8px;
      color: var(--text) !important;
      font-family: var(--admin-font);
      font-size: 16px;
      font-weight: 500;
    }

    body[data-ui-lang] :is(input, select, textarea):is([readonly], :disabled) {
      background: var(--admin-canvas) !important;
      border: 1px solid var(--border) !important;
      border-radius: 8px;
      color: var(--muted) !important;
    }

    body[data-ui-lang] :is(input, textarea)::placeholder {
      color: var(--muted);
    }

    body[data-ui-lang] :is(input, select, textarea):focus,
    body[data-ui-lang] :is(a, button, summary):focus-visible,
    body[data-ui-lang] .appointment-field-shell:focus-within {
      outline: 1px solid var(--admin-focus);
      outline-offset: 2px;
      box-shadow: var(--admin-ring) !important;
    }

    /* Distribution uses its own component styles and a PHP-generated chart. */
    body[data-ui-lang] .ssc-dp {
      --red: var(--admin-primary);
      --gold: #9e7e46;
      --dp-type-country: #2b241d;
      --dp-type-regional: #9e7e46;
      --dp-type-city: #c4a870;
      --dp-type-clinic: #e7dcc7;
      background: var(--admin-canvas);
      color: var(--text);
      font-family: var(--admin-font);
      font-size: 14px;
      font-weight: 400;
    }

    body[data-ui-lang] .ssc-dp a { color: var(--admin-link); }

    body[data-ui-lang] .ssc-dp h1,
    body[data-ui-lang] .ssc-dp h2,
    body[data-ui-lang] .ssc-dp h3 {
      color: var(--text);
      font-family: var(--admin-display);
      font-weight: 500;
    }

    body[data-ui-lang] .ssc-dp h1 { font-size: 36px; }
    body[data-ui-lang] .ssc-dp h2 { font-size: 30px; }
    body[data-ui-lang] .ssc-dp h3 { font-size: 21px; }
    body[data-ui-lang] .ssc-dp .dp-hero { background: var(--bg-soft); }

    body[data-ui-lang] .ssc-dp .dp-eyebrow {
      color: var(--deep-gold);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: .13em;
      text-transform: uppercase;
    }

    body[data-ui-lang] .ssc-dp .dp-card {
      background: var(--bg);
      border-color: var(--border);
      border-radius: 17px;
      box-shadow: var(--admin-surface-shadow);
    }

    body[data-ui-lang] .ssc-dp .dp-orb {
      background: var(--admin-gold-gradient);
      color: var(--admin-ink);
      box-shadow: none;
    }

    body[data-ui-lang] .ssc-dp :is(.dp-number, .dp-donut-hole b) {
      font-family: var(--admin-display);
      font-size: 44px;
      font-weight: 500;
      font-variant-numeric: lining-nums tabular-nums;
    }

    body[data-ui-lang] .ssc-dp .dp-change { color: var(--green); }
    body[data-ui-lang] .ssc-dp :is(.dp-muted, .dp-empty, .dp-help) { color: var(--muted); }
    body[data-ui-lang] .ssc-dp :is(.dp-help, .dp-stat small) { font-size: 12px; }
    body[data-ui-lang] .ssc-dp .dp-donut-hole { background: var(--bg); }

    body[data-ui-lang] .ssc-dp .dp-donut[style="background:#e8e8eb"] {
      background: var(--bg-soft) !important;
    }

    body[data-ui-lang] .ssc-dp .dp-legend-row:last-child .dp-swatch {
      outline: 1px solid var(--dp-type-city);
    }

    body[data-ui-lang] .ssc-dp .dp-level {
      background: var(--bg);
      border-color: var(--border);
    }

    body[data-ui-lang] .ssc-dp .dp-level-top {
      background: var(--admin-primary);
      color: var(--bg);
      font-weight: 500;
    }

    body[data-ui-lang] .ssc-dp .dp-level:nth-child(2) .dp-level-top { background: var(--deep-gold); }
    body[data-ui-lang] .ssc-dp .dp-level:nth-child(3) .dp-level-top {
      background: var(--admin-gold-gradient);
      color: var(--admin-ink);
    }
    body[data-ui-lang] .ssc-dp .dp-level:nth-child(4) .dp-level-top {
      background: var(--bg-soft);
      color: var(--deep-gold);
    }

    body[data-ui-lang] .ssc-dp :is(.dp-chip, .dp-level:last-child .dp-chip) {
      background: var(--admin-chip);
      color: var(--deep-gold);
      font-size: 12px;
      font-weight: 400;
    }

    body[data-ui-lang] .ssc-dp .dp-level:nth-child(3) :is(svg, p, .dp-chip) {
      color: var(--admin-ink);
    }

    body[data-ui-lang] .ssc-dp .dp-world { color: var(--border); }
    body[data-ui-lang] .ssc-dp .dp-coverage-row { border-color: var(--border); }
    body[data-ui-lang] .ssc-dp .dp-coverage-row svg { color: var(--gold); }

    body[data-ui-lang] .ssc-dp .dp-tabs a {
      background: var(--bg);
      color: var(--admin-nav);
      border-color: var(--border);
      font-size: 13px;
      font-weight: 500;
    }

    body[data-ui-lang] .ssc-dp .dp-button {
      background: var(--bg);
      color: var(--admin-ink);
      border-color: var(--admin-secondary-border);
      border-radius: 11px;
      font-size: 13px;
      font-weight: 500;
    }

    body[data-ui-lang] .ssc-dp .dp-button:hover { background: var(--admin-hover); }

    body[data-ui-lang] .ssc-dp .dp-button-primary,
    body[data-ui-lang] .ssc-dp .dp-tabs a[aria-current] {
      background: var(--red);
      color: var(--bg);
      border-color: var(--admin-primary-hover);
    }

    body[data-ui-lang] .ssc-dp .dp-button-primary:hover { background: var(--admin-primary-hover); }

    body[data-ui-lang] .ssc-dp table,
    body[data-ui-lang] .ssc-dp .dp-recent table { font-size: 13px; }

    body[data-ui-lang] .ssc-dp :is(th, .dp-recent th) {
      background: var(--bg-soft);
      color: var(--muted);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    body[data-ui-lang] .ssc-dp table :is(th, td) { border-color: var(--border); }

    body[data-ui-lang] .ssc-dp :is(.dp-badge, .dp-recent .dp-badge) {
      border: 1px solid transparent;
      font-size: 12px;
      font-weight: 400;
      letter-spacing: 0;
    }

    body[data-ui-lang] .ssc-dp .dp-badge.country_exclusive {
      background: var(--admin-primary);
      color: var(--bg);
    }
    body[data-ui-lang] .ssc-dp .dp-badge.regional_exclusive {
      background: var(--gold);
      color: var(--admin-ink);
    }
    body[data-ui-lang] .ssc-dp .dp-badge.city_exclusive {
      background: var(--admin-input-border);
      color: var(--admin-ink);
    }
    body[data-ui-lang] .ssc-dp .dp-badge.clinic_wellness {
      background: var(--border);
      color: var(--text);
    }

    body[data-ui-lang] .ssc-dp :is(.dp-badge.active, .dp-alert) {
      background: var(--admin-success);
      border-color: var(--admin-success-border);
      color: var(--green);
    }
    body[data-ui-lang] .ssc-dp .dp-badge.pending {
      background: var(--admin-chip);
      border-color: var(--admin-chip-border);
      color: var(--deep-gold);
    }
    body[data-ui-lang] .ssc-dp .dp-badge.inactive {
      background: var(--bg-soft);
      border-color: var(--border);
      color: var(--muted);
    }
    body[data-ui-lang] .ssc-dp :is(.dp-badge.expired, .dp-alert.dp-errors) {
      background: var(--admin-chip);
      border-color: var(--admin-chip-border);
      color: var(--danger);
    }

    body[data-ui-lang] .ssc-dp label {
      color: var(--muted);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    body[data-ui-lang] .ssc-dp :is(a, button, input, select, textarea):focus-visible {
      outline: 1px solid var(--admin-focus);
      outline-offset: 2px;
      box-shadow: var(--admin-ring) !important;
    }

    body.ssc-dp-page[data-ui-lang] .sidebar .nav-group[data-nav-group="Distribution & Partnerships"] > summary {
      background: var(--bg) !important;
      color: var(--admin-nav) !important;
    }

    body.ssc-dp-page[data-ui-lang] .sidebar .nav-group[data-nav-group="Distribution & Partnerships"] > summary:hover {
      color: var(--admin-selected) !important;
    }

    body.ssc-dp-page[data-ui-lang] .sidebar .nav-group[data-nav-group="Distribution & Partnerships"] .nav-icon {
      background: var(--bg-soft) !important;
      color: var(--deep-gold) !important;
      border-color: var(--border) !important;
    }

    body.ssc-dp-page[data-ui-lang] .sidebar .nav-group[data-nav-group="Distribution & Partnerships"] > summary::after {
      color: var(--deep-gold) !important;
      border-color: var(--border) !important;
    }

    body.ssc-dp-page[data-ui-lang] .sidebar .nav-group[data-nav-group="Distribution & Partnerships"] .nav-subitem:is(.active, :hover) {
      background: var(--bg) !important;
      color: var(--admin-selected) !important;
      border-color: transparent !important;
      border-radius: var(--highlight-radius);
    }
  }
}
/* backoffice-desktop-20261130: duplicate page headings */
@media (min-width: 901px) {
  @media screen {
    .content:not(.embedded-content) .bo-dup-title,
    .content:not(.embedded-content) .ssc-dp .dp-hero .dp-eyebrow,
    .content:not(.embedded-content) .section-title:has(> .bo-dup-title:only-child) { display: none; }
  }
}

/* backoffice-desktop-20261130: staff search, filters and pagination */
@media (min-width: 901px) {
  .bo-desktop-only[hidden]:not(.client-detail-desktop) { display: block; }
  .badge.badge-grey.bo-desktop-only[hidden] { display: inline-flex; }
  tbody.bo-desktop-only[hidden] { display: table-row-group; }
  tr.bo-desktop-only[hidden] { display: table-row; }
  .bo-mobile-only:not(.client-detail-legacy), .bo-desktop-hidden { display: none !important; }
  .bo-topbar-search[hidden], .bo-filter-bar[hidden], .bo-pager[hidden] {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .topbar:has(> .bo-topbar-search) { flex-wrap: wrap; gap: 12px; }
  .topbar:has(> .bo-topbar-search) > .topbar-title { flex: 1 1 min-content; max-width: 100%; }
  .topbar:has(> .bo-topbar-search) > .profile-pill { flex: 0 0 auto; max-width: 100%; gap: 8px; }
  .bo-topbar-search { flex: 1 1 8rem; max-width: 17rem; min-width: 0; }
  .bo-topbar-search input { flex: 1 1 12.5rem; width: 100%; min-width: 0; }
  .bo-topbar-search button { flex: 0 0 auto; white-space: nowrap; }
  .bo-filter-bar[hidden] { flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
  .bo-filter-bar label { display: grid; gap: 4px; }
  .bo-pager[hidden] { flex-wrap: wrap; margin-top: 12px; }
  .bo-list-search { display: block; max-width: 19rem; margin-bottom: 12px; }
}

/* backoffice-desktop-20261130: enquiry callback and phone links */
@media (min-width: 901px) {
  .bo-phone[hidden], .bo-callback[hidden] { display: inline; }
}

/* backoffice-desktop-20261130: Follow Up row actions */
@media (min-width: 901px) {
  .follow-action-column { width: 10rem; }
  .bo-more { position: relative; }
  .bo-more-menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 4px);
    z-index: 2;
    display: grid;
    gap: 4px;
    padding: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  /* Leave room for the last row's menu inside the horizontally scrollable table. */
  .follow-up-table:has(.bo-more[open]) { padding-bottom: 11rem; }
}

/* admin-client-detail-20261201: desktop client header, tabs, overview and notes drawer */
@media not screen and (min-width: 901px) {
  .client-detail-desktop[hidden],
  .client-detail-notes,
  .client-detail-notes::backdrop { display: none !important; }
}

@media (min-width: 901px) {
  @media screen {
    .client-detail-legacy.bo-mobile-only { display: none; }
    .client-detail-desktop.bo-desktop-only[hidden] { display: block; }
    .client-detail-heading.bo-desktop-only[hidden] {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto auto;
      align-items: start;
      gap: 14px;
    }
    .client-detail-header-slot { flex: 1 1 auto; min-width: 0; }
    .client-detail-availability { display: grid; justify-items: end; gap: 4px; }
    .client-detail-tabs.bo-desktop-only[hidden] { display: flex; }
    .client-detail-overview.bo-desktop-only[hidden] { display: grid; }
    .client-detail-sections.bo-desktop-only[hidden] { display: contents; }
    .client-detail-heading:has(.client-detail-availability):not(:has([data-client-detail-open-notes])) {
      grid-template-columns: minmax(0, 1fr) auto;
    }
    .client-modal-panel.client-detail-notes {
      position: fixed;
      inset: 0 0 0 auto;
      width: min(760px, 100vw);
      height: 100%;
      max-width: 100vw;
      max-height: 100%;
      margin: 0;
      padding: 0;
      border-radius: 0;
    }
    .client-detail-notes::backdrop { background: var(--ssc-text); opacity: .48; }
    .client-detail-notes .client-modal-head { align-items: center; }
    .client-detail-notes .client-modal-body { overflow: visible; }
  }
}

@media (min-width: 901px) {
  [data-client-detail-overview] > .phase1-overview-wallet { grid-column: 1 / -1; }
  .phase1-overview-details {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
  }
  .phase1-overview-details .client-card { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 4px 8px; }
  .phase1-overview-details .client-card :is(h3, p) { margin: 0; }

  .phase1-client-filters .bo-filter-bar[hidden] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    align-items: end;
  }
  .phase1-client-filters .bo-filter-bar > label { min-width: 0; }

  .grid.phase1-dashboard-stats,
  .grid.phase1-dashboard-stats.bo-desktop-only[hidden] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  }
  .phase1-dashboard-stats .stat { min-width: 0; overflow-wrap: anywhere; }
  .phase1-dashboard-lists > section { display: grid; grid-template-rows: subgrid; grid-row: span 2; min-width: 0; }
  .phase1-dashboard-lists > section > .section-title { flex-wrap: wrap; align-self: end; }
  .phase1-dashboard-lists > section > .table-wrap { align-self: start; }
  .grid-2:has(> section > .phase1-dashboard-table) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 32rem), 1fr));
  }
  .phase1-dashboard-table > table { min-width: 0; }
  .phase1-dashboard-table :is(th, td) { white-space: normal; overflow-wrap: anywhere; padding-inline: 8px; }
  .phase1-dashboard-table td .badge { white-space: normal; }
  .phase1-dashboard-link { order: 2; margin-inline-start: 4px; }

  .content :is(.inventory-summary, #invoices .finance-summary-grid) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .content .inventory-summary:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phase1-invoice-more > summary.bo-desktop-only[hidden] { display: list-item; }
  .family-groups-summary.bo-desktop-only[hidden] { display: grid; }
  .content :is(.inventory-summary, #invoices .finance-summary-grid) > :last-child:nth-child(7) {
    grid-column: span 2;
  }
  .content #inventoryTable { min-width: 0; }
  #inventoryTable :is(th, td) { padding-inline: 6px; overflow-wrap: anywhere; }
  #inventoryTable :is(th, td):last-child { width: 5.5rem; white-space: nowrap; }

  .content :is(.phase1-invoice-filters, .follow-filters, .therapy-filter-grid, .enq-filters) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    align-items: end;
  }
  .content :is(.phase1-invoice-filters, .follow-filters, .enq-filters) > :first-child:not([type=hidden]),
  .content .phase1-invoice-filters > label:first-of-type,
  .content .follow-filters > label:first-of-type { grid-column: span 2; }
  .content :is(.phase1-invoice-filters, .follow-filters, .therapy-filter-grid, .enq-filters) :is(input, select) {
    width: 100%;
    min-width: 0;
  }
  .content :is(.phase1-invoice-filters, .follow-filters, .enq-filters) :is(.actions, .enq-actions) { flex-wrap: wrap; }
  .content .therapy-filter-grid > input[type=search] { grid-column: span 2; }
  .content .therapy-filter-grid > select[name="therapy_sort"] { grid-column: span 2; }
  .therapy-clean-section th > .bo-desktop-only { white-space: nowrap; }

  .content .phase1-enquiries-table .enq-table { min-width: 0; }
  .phase1-enquiries-table :is(th, td) { white-space: normal; overflow-wrap: anywhere; padding-inline: 6px; }
  .phase1-enquiries-table td .badge { white-space: normal; }
  .follow-up-table th { overflow-wrap: normal; }
  .follow-up-table td > .bo-desktop-only { margin-top: 8px; }

  .content:has(.report-kpis) .topbar-title h1 { white-space: nowrap; }
  .content:has(.report-kpis) .topbar { flex-wrap: wrap; }
  .content .report-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
  .content .report-kpis + .report-kpis { gap: 8px; }
  .report-kpis + .report-kpis > .summary-card { padding: 8px 12px; }
  .content .ssc-dp .dp-tabs { flex-wrap: wrap; }
  .phase1-staff-email { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .phase1-logo-field { display: grid; justify-items: start; gap: 7px; }
  .phase1-logo-field .btn #systemLogo { display: none; }
  .phase1-logo-field output { overflow-wrap: anywhere; }
}
