html, body { height: 100%; margin: 0; padding: 0; }
:root {
  --bg: #f4f6fb;
  --ink: #141826;
  --muted: #6b7280;
  --brand: #2d6cdf;
  --brand-dark: #244ea6;
  --sidebar: #0f1324;
  --sidebar-accent: #1b2140;
  --card: #ffffff;
  --border: #e6e8f0;
  --success: #1fbf75;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-sans: "Barlow", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Barlow", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 18px 45px rgba(19, 27, 51, 0.08);
  --context-drawer-width: clamp(390px, 31vw, 480px);
  --app-header-height: 56px;
  --app-header-offset: 56px;
  --app-footer-height: 46px;
  --context-bar-height: 48px;
  --toolbar-height: 42px;
  --page-pad-x: 18px;
  --page-pad-y: 16px;
  --card-pad: 14px;
  --card-gap: 14px;
  --control-height: 32px;
  --control-radius: 8px;
  --compact-row-pad-y: 8px;
  --compact-row-pad-x: 10px;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 500;
  letter-spacing: 0;
}

strong,
b {
  font-weight: 500;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--control-height);
  padding: 8px 13px;
  border-radius: var(--control-radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 12px 24px rgba(45, 108, 223, 0.25);
}

.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}

.btn-ghost:hover { border-color: #cbd5f5; }

.btn-danger {
  color: var(--danger);
  border-color: #f7c2c2;
}

.btn-danger:hover {
  background: #fde8e8;
  border-color: #f2a8a8;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.hero {
  background: url('assets/imgs/splash-bg.jpg') center/75% no-repeat;
  padding: 80px 0 120px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 18, 35, 0.72), rgba(12, 18, 35, 0.55));
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 10%, rgba(61, 120, 255, 0.25), transparent 55%);
  z-index: 1;
}

.hero .container {
  position: relative;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500;
}

.badge-success { background: #e7f7ee; color: #1f7a4b; border-color: #cdeedb; }
.badge-warning { background: #fff4d9; color: #9a6a00; border-color: #ffe3a3; }
.badge-danger { background: #fde8e8; color: #b42318; border-color: #f7c2c2; }
.badge-info { background: #e8f2ff; color: #2b5fd2; border-color: #cfe0ff; }
.badge-proband { background: #e8f2ff; color: #2b5fd2; border-color: #cfe0ff; margin-left: 8px; }
.badge-proband i { font-size: 10px; }
.badge-variation { background: #f2ecff; color: #5a35b5; border-color: #decfff; margin-left: 8px; }
.badge-variation i { font-size: 10px; }

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(18, 24, 40, 0.45);
  z-index: 1000;
  padding: 24px;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #e6e9f3;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.modal-header h3 { margin: 0; }

.modal-header p {
  margin: 4px 0 0 0;
  color: #667085;
  font-size: 13px;
}

.modal-close {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: #344054;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: var(--control-height);
  margin: 0;
  padding: 6px 9px;
  border: 1px solid #d0d5dd;
  border-radius: var(--control-radius);
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.form-group textarea {
  min-height: 64px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2d6cdf;
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.15);
  background: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.modal-feedback {
  margin-top: 12px;
  font-size: 13px;
  color: #475467;
}

@media (max-width: 820px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .patient-relative-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 10px;
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.5px;
  color: #f8fbff;
}

.navbar .logo img {
  height: 36px;
  width: auto;
  display: block;
}

.navbar .links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  align-items: center;
  margin-top: 40px;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 46px);
  margin: 0 0 16px;
  color: #f8fbff;
}

.hero p {
  color: rgba(248, 251, 255, 0.85);
  font-size: 16px;
  line-height: 1.6;
}

.hero-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(3px);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero .btn-ghost {
  color: #f8fbff;
  border-color: rgba(248, 251, 255, 0.5);
}

.hero .btn-ghost:hover {
  border-color: #f8fbff;
}

.section {
  padding: 60px 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.feature {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
}

.feature i {
  color: var(--brand);
  font-size: 22px;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
  background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 55%, #f7f8ff 100%);
}

.auth-card {
  width: min(420px, 92vw);
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-card-wide {
  width: min(560px, 92vw);
}

.auth-card h2 { margin: 0 0 6px; }

.auth-card .muted { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.auth-links a,
.auth-links button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}

.auth-inline-form {
  margin: 0;
}

input[type="email"],
input[type="password"],
input[type="text"],
.auth-card select,
textarea {
  width: 100%;
  padding: 9px 11px;
  margin: 4px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  outline: none;
  font-size: 14px;
  font-family: inherit;
}

.auth-card select {
  background: var(--card);
  color: inherit;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
.auth-card select:focus,
textarea:focus { border-color: #9bb9ff; box-shadow: 0 0 0 3px rgba(45,108,223,0.12); }

.error { color: var(--danger); font-size: 13px; margin-bottom: 10px; }

.success {
  color: #147a4c;
  background: #e7f7ee;
  border: 1px solid #cdeedb;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-width: 0;
  background: #0f1324;
  color: #d6dbff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(15, 19, 36, 0.12);
}

.app-header-inner {
  height: var(--app-header-height);
  min-height: 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 22px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.app-brand img {
  width: 27px;
  height: 27px;
  object-fit: contain;
}

.app-primary-nav {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  min-width: 0;
  gap: 4px;
}

.app-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: #aeb7df;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.app-nav-link::after {
  content: '';
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

.app-nav-link:hover,
.app-nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.app-nav-link.is-active::after {
  background: #4c8dff;
}

.app-nav-link.is-locked {
  color: #c3cae9;
}

.app-nav-lock,
.patient-workspace-tabs a .fa-lock {
  font-size: 10px;
  opacity: 0.72;
}

.app-account-menu {
  position: relative;
}

.app-account-menu summary {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 172px) 12px;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  list-style: none;
  color: #fff;
}

.app-account-menu summary::-webkit-details-marker {
  display: none;
}

.app-account-menu summary:hover,
.app-account-menu[open] summary {
  background: rgba(255, 255, 255, 0.08);
}

.app-account-menu[open] summary > .fa-chevron-down {
  transform: rotate(180deg);
}

.app-account-menu summary > .fa-chevron-down {
  font-size: 10px;
  transition: transform .18s ease;
}

.app-account-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2d6cdf;
  color: #fff;
  font-weight: 500;
}

.app-account-summary {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.app-account-summary strong,
.app-account-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-account-summary strong {
  font-size: 12px;
}

.app-account-summary small {
  color: #9ba7d7;
  font-size: 10px;
}

.app-account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 290px;
  overflow: hidden;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.2);
}

.app-account-status {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: #f7f8fc;
  border-bottom: 1px solid var(--border);
}

.app-account-status > span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.app-account-status strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.app-system-status {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
}

.app-system-status i {
  font-size: 7px;
}

.app-system-status.is-connected {
  color: #14845b;
}

.app-system-status.is-warning {
  color: #b45309;
}

.app-account-popover nav {
  display: grid;
  padding: 8px;
}

.app-account-popover nav a,
.app-account-popover nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #30384d;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.app-account-popover nav a i,
.app-account-popover nav button i {
  width: 17px;
  color: #778198;
  text-align: center;
}

.app-account-popover nav a:hover,
.app-account-popover nav button:hover {
  background: #f0f4fb;
  color: var(--brand-dark);
}

.app-account-logout-form {
  margin: 6px 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.app-account-popover nav .app-account-logout {
  border-radius: 0 0 6px 6px;
  color: var(--danger);
}

.sidebar {
  min-height: 100vh;
  background: var(--sidebar);
  color: #d6dbff;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar .brand {
  font-family: var(--font-display);
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .brand img {
  height: 30px;
  width: auto;
  display: block;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar a,
.sidebar button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b9c1ff;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.sidebar a.active,
.sidebar a:hover,
.sidebar button:hover {
  background: var(--sidebar-accent);
  color: #fff;
}

.sidebar-logout-form {
  margin: 0;
}

.sidebar-account {
  display: grid;
  gap: 3px;
  margin-top: auto;
  color: #7e88c8;
  font-size: 12px;
  line-height: 1.25;
}

.sidebar-account strong {
  color: #9aa4e8;
  font-weight: 500;
  word-break: break-word;
}

.sidebar-system-status {
  margin-top: 8px;
  font-weight: 500;
}

.sidebar-system-status.is-connected {
  color: #58d68d;
}

.sidebar-system-status.is-warning {
  color: #f7bf54;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 24px 28px;
}

.app-shell--module .main {
  max-width: none;
  padding: 0;
}

.module-page {
  min-width: 0;
  min-height: calc(100dvh - var(--app-header-height));
  display: flex;
  flex-direction: column;
}

.app-shell:not(.app-shell--workspace) .module-page {
  min-height: calc(100dvh - var(--app-header-height) - var(--app-footer-height));
}

.app-footer {
  flex: 0 0 auto;
  min-height: var(--app-footer-height);
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.96);
  color: #667085;
}

.app-footer-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 20px;
}

.app-footer-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.app-footer-brand span {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
}

.app-footer-brand small {
  color: var(--muted);
  font-size: 11px;
}

.app-footer-links {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.app-footer-links a {
  border-radius: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 7px 8px;
}

.app-footer-links a:hover {
  background: #eef2ff;
  color: var(--brand-dark);
}

.module-context-bar {
  min-height: var(--context-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--page-pad-x);
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.module-context-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-context-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #dbe3f1;
  border-radius: 7px;
  background: #f7f9fc;
  color: var(--brand);
  font-size: 14px;
}

.module-context-identity > div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.module-context-identity > div > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.module-context-identity h1,
.module-context-identity h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-toolbar {
  flex: 0 0 auto;
}

.module-toolbar-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #59647a;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.module-toolbar-label i {
  color: #7b879c;
}

.module-search {
  width: min(620px, 100%);
  flex: 0 1 620px;
  padding: 6px 10px;
  border-radius: var(--control-radius);
  background: #fff;
}

.module-content {
  min-width: 0;
  flex: 1;
  padding: var(--page-pad-y) var(--page-pad-x) 22px;
}

.module-content > .table-card,
.module-content .dashboard-overview-grid > .table-card {
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(19, 27, 51, 0.05);
}

.module-context-meta {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6e788d;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.module-context-meta i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.patient-detail-content {
  scroll-behavior: smooth;
}

.patient-detail-page {
  --patient-context-height: 58px;
}

.patient-detail-context-bar {
  position: sticky;
  top: var(--app-header-offset, 56px);
  z-index: 90;
  box-shadow: 0 8px 20px rgba(15, 19, 36, 0.06);
}

.patient-detail-content [id^='patient-'] {
  scroll-margin-top: calc(var(--app-header-offset, 56px) + var(--patient-context-height) + 16px);
}

.patient-detail-toolbar .btn {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 7px;
}

.patient-detail-toolbar .btn-primary {
  box-shadow: none;
}

.app-shell--workspace {
  height: 100dvh;
  overflow: hidden;
}

.app-shell--workspace .main {
  min-height: 0;
  max-width: none;
  padding: 0;
  display: flex;
  overflow: hidden;
}

.app-drawer-backdrop,
.app-context-drawer {
  position: fixed;
  top: var(--app-header-offset, 56px);
  right: 0;
  bottom: 0;
}

.app-drawer-backdrop {
  left: 0;
  z-index: 84;
  background: rgba(15, 19, 36, 0.24);
  opacity: 0;
  transition: opacity 220ms ease;
}

.app-context-drawer {
  z-index: 90;
  width: var(--context-drawer-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-left: 1px solid #dce2ed;
  box-shadow: -18px 0 38px rgba(15, 19, 36, 0.12);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.app-drawer-backdrop[hidden],
.app-context-drawer[hidden] {
  display: none !important;
}

.has-context-drawer .app-context-drawer {
  transform: translateX(0);
}

.has-context-drawer .app-drawer-backdrop {
  opacity: 1;
}

.app-shell--workspace .app-drawer-backdrop {
  display: none;
}

.app-drawer-header {
  min-height: 68px;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.app-drawer-header > div {
  min-width: 0;
}

.app-drawer-header span {
  display: block;
  margin-bottom: 2px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.app-drawer-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.app-drawer-header p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-drawer-close {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: #59647a;
  cursor: pointer;
}

.app-drawer-close:hover {
  border-color: #b9c9ec;
  color: var(--brand);
}

.app-drawer-body {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: #f8fafc;
}

.app-drawer-footer {
  flex: 0 0 auto;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
}

.app-drawer-footer .btn {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  box-shadow: none;
}

.app-context-drawer .patient-detail-page {
  min-height: 0;
  display: block;
  background: #f8fafc;
}

.app-context-drawer .patient-detail-context-bar,
.app-context-drawer .patient-detail-toolbar {
  display: none;
}

.app-context-drawer .patient-detail-content {
  padding: 0;
}

.app-context-drawer .patient-detail-grid,
.app-context-drawer .patient-detail-main,
.app-context-drawer .patient-detail-side {
  display: block;
}

.app-context-drawer .patient-detail-card {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.app-context-drawer .patient-detail-card + .patient-detail-card {
  margin-top: 0;
}

.app-context-drawer .form-grid,
.app-context-drawer .patient-detail-tight-grid,
.app-context-drawer .patient-cancer-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-context-drawer .patient-summary-grid,
.app-context-drawer .patient-canrisk-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-context-drawer .form-grid > .form-group:only-child {
  grid-column: 1 / -1;
}

.app-context-drawer .patient-section-header {
  margin-bottom: 10px;
}

.app-context-drawer .patient-section-header h3,
.app-context-drawer .patient-detail-card > h3 {
  font-size: 16px;
}

.app-context-drawer .patient-webform-metrics,
.app-context-drawer .patient-document-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.app-context-drawer .patient-document-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-context-drawer .patient-webform-metrics div,
.app-context-drawer .patient-document-metrics div {
  padding: 8px 9px;
}

.app-context-drawer .patient-webform-metrics span,
.app-context-drawer .patient-document-metrics span {
  margin-bottom: 3px;
  font-size: 10px;
}

.app-context-drawer .patient-webform-metrics strong,
.app-context-drawer .patient-document-metrics strong {
  font-size: 14px;
}

.app-context-drawer .patient-document-preview iframe,
.app-context-drawer .patient-report-preview iframe {
  height: 320px;
}

.app-context-drawer .patient-document-preview-header strong {
  max-width: 260px;
}

.app-context-drawer [data-patient-panel][hidden] {
  display: none !important;
}

.app-context-drawer .patient-detail-feedback:empty {
  display: none;
}

.app-context-drawer .patient-detail-feedback:not(:empty) {
  margin: 12px 16px 0;
}

.calendar-drawer-content {
  padding: 14px;
}

.calendar-drawer-content .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calendar-drawer-content .modal-actions {
  position: sticky;
  bottom: -14px;
  margin: 14px -14px -14px;
  padding: 10px 14px;
  background: #fff;
  border-top: 1px solid var(--border);
}

.editor-workspace {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #edf1f7;
}

.editor-patient-bar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, auto) minmax(170px, 1fr);
  align-items: stretch;
  gap: 20px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

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

.editor-back-link {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: #59647a;
}

.editor-back-link:hover {
  border-color: #b9c9ec;
  color: var(--brand);
}

.editor-patient-identity > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.editor-patient-identity span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.editor-patient-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.patient-workspace-tabs {
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.patient-workspace-tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  color: #737d91;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.patient-workspace-tabs a::after {
  content: '';
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

.patient-workspace-tabs a:hover,
.patient-workspace-tabs a.is-active {
  color: var(--brand-dark);
}

.patient-workspace-tabs a.is-locked {
  color: #737d91;
}

.patient-workspace-tabs a.is-locked .fa-lock {
  margin-left: 2px;
}

.patient-workspace-tabs a.is-disabled {
  color: #a8afbd;
  cursor: not-allowed;
  pointer-events: none;
}

.patient-workspace-tabs a.is-active::after {
  background: var(--brand);
}

.patient-detail-tabs-bar {
  height: 48px;
  margin-bottom: 18px;
  padding: 0 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(19, 27, 51, 0.04);
}

.editor-save-state {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6e788d;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.editor-save-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.editor-save-state.is-ready i,
.editor-save-state.is-saved i {
  background: var(--success);
}

.editor-save-state.is-working i {
  background: var(--warning);
}

.editor-save-state.is-dirty {
  color: #9a5b08;
}

.editor-save-state.is-dirty i {
  background: var(--warning);
}

.editor-shell-toolbar {
  min-height: var(--toolbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 5px var(--page-pad-x);
  background: #f8fafc;
  border-bottom: 1px solid #dce2ed;
}

.editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.editor-shell-toolbar .btn {
  min-height: var(--control-height);
  padding: 6px 10px;
  border-radius: var(--control-radius);
}

.editor-shell-toolbar .btn-primary {
  box-shadow: none;
}

.editor-icon-button {
  width: var(--control-height);
  padding: 0 !important;
}

.editor-frame-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: #fff;
}

.editor-frame-wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
}

.editor-frame-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.editor-frame-loading[hidden] {
  display: none;
}

.editor-frame-loading i {
  color: var(--brand);
  font-size: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.topbar h2 {
  margin: 0 0 4px;
}

.topbar p {
  margin: 0;
}

.search {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.search input::placeholder {
  color: var(--muted);
}

.table-card {
  background: var(--card);
  border-radius: 10px;
  padding: var(--card-pad);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.dashboard-table-card {
  min-height: 0;
}

.table-card h3 {
  margin-top: 0;
  font-size: 18px;
  line-height: 1.2;
}

.form-group-wide {
  grid-column: 1 / -1;
}

.patient-modal-content {
  max-width: 880px;
  max-height: min(92vh, 920px);
  padding: 18px 22px;
  overflow-y: auto;
}

.patient-modal-content .modal-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.patient-create-form {
  padding-top: 0;
}

.patient-create-form .form-group {
  gap: 3px;
}

.patient-create-form .form-group input,
.patient-create-form .form-group select,
.patient-create-form .form-group textarea {
  min-height: 32px;
  padding: 5px 8px;
}

.patient-create-form .form-group textarea {
  min-height: 58px;
}

.patient-create-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(170px, .9fr) 164px minmax(132px, .7fr);
  gap: 8px 10px;
  align-items: end;
}

.patient-create-grid .patient-name-field {
  grid-column: span 2;
}

.patient-create-grid .patient-select-field,
.patient-create-grid .patient-date-field {
  min-width: 0;
}

.patient-create-grid .patient-contact-field {
  min-width: 0;
}

.patient-create-grid .patient-email-field {
  grid-column: span 2;
}

.patient-create-form input[type="date"] {
  max-width: 170px;
}

.patient-create-grid > .patient-family-section {
  margin-top: 2px;
}

.patient-table-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.patient-chart-link {
  color: var(--brand);
  font-weight: 500;
}

.patient-family-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcff;
  padding: 10px 12px;
  display: grid;
  gap: 9px;
}

.patient-family-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.patient-family-heading h4,
.patient-relative-block h5 {
  margin: 0;
}

.patient-family-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.patient-family-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 164px minmax(140px, 1fr) 164px;
  gap: 8px 10px;
  align-items: end;
}

.patient-family-grid .patient-count-field {
  max-width: 150px;
}

.patient-family-grid .patient-coparent-field {
  grid-column: span 2;
}

.patient-relative-block {
  display: grid;
  gap: 8px;
}

.patient-relative-list {
  display: grid;
  gap: 6px;
}

.patient-relative-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(118px, 140px) 164px;
  gap: 8px;
  align-items: end;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

@media (max-width: 900px) {
  .patient-create-grid {
    grid-template-columns: minmax(0, 1fr) 164px;
  }
  .patient-create-grid .patient-name-field,
  .patient-create-grid .patient-email-field,
  .patient-create-grid .patient-family-section,
  .patient-create-grid .form-group-wide {
    grid-column: 1 / -1;
  }
  .patient-family-grid {
    grid-template-columns: minmax(0, 1fr) 164px;
  }
  .patient-family-grid .patient-coparent-field {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .patient-modal-content {
    padding: 16px;
  }
  .patient-create-grid,
  .patient-family-grid,
  .patient-relative-row {
    grid-template-columns: 1fr;
  }
  .patient-create-form input[type="date"],
  .patient-family-grid .patient-count-field {
    max-width: none;
  }
}

.modal-feedback.is-error {
  color: var(--danger);
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(286px, 330px);
  gap: var(--card-gap);
  align-items: start;
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-card-header h3 {
  margin: 0;
}

.dashboard-calendar-card {
  position: sticky;
  top: 14px;
}

.dashboard-calendar-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.dashboard-calendar-stat {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f8fafc;
  padding: 10px;
}

.dashboard-calendar-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dashboard-calendar-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.dashboard-calendar-feedback {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0;
}

.dashboard-mini-calendar-toolbar {
  display: grid;
  grid-template-columns: 30px 1fr 30px 48px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.dashboard-mini-calendar-toolbar .btn {
  min-width: 0;
  padding: 6px;
}

.dashboard-mini-calendar-toolbar strong {
  min-width: 0;
  text-align: center;
  text-transform: capitalize;
  font-size: 13px;
}

.dashboard-mini-calendar-weekdays,
.dashboard-mini-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dashboard-mini-calendar-weekdays {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 4px;
}

.dashboard-mini-calendar-weekdays span {
  padding: 4px 0;
}

.dashboard-mini-calendar-grid {
  gap: 3px;
}

.dashboard-mini-calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 3px 2px;
  font: inherit;
}

.dashboard-mini-calendar-day.is-outside {
  color: #98a2b3;
  background: #f8fafc;
}

.dashboard-mini-calendar-day.is-today {
  border-color: var(--brand);
}

.dashboard-mini-calendar-day.is-selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.dashboard-mini-calendar-day span {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.dashboard-mini-calendar-day em {
  min-height: 5px;
  display: flex;
  justify-content: center;
  gap: 2px;
}

.dashboard-mini-calendar-day em i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  display: block;
  background: var(--event-color, var(--brand));
}

.dashboard-mini-calendar-day em i.is-appointment { --event-color: #2d6cdf; }
.dashboard-mini-calendar-day em i.is-pedigree { --event-color: #1f9d73; }
.dashboard-mini-calendar-day em i.is-webform { --event-color: #a15c16; }

.dashboard-calendar-selected {
  margin: 0 0 8px;
  text-transform: capitalize;
  font-size: 14px;
}

.dashboard-calendar-list {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  overflow-x: hidden;
}

.dashboard-calendar-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--event-color, var(--brand));
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.dashboard-calendar-item.is-appointment { --event-color: #2d6cdf; }
.dashboard-calendar-item.is-pedigree { --event-color: #1f9d73; }
.dashboard-calendar-item.is-webform { --event-color: #a15c16; }

.dashboard-calendar-item span {
  color: var(--event-color, var(--brand));
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.dashboard-calendar-item strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dashboard-calendar-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.dashboard-calendar-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: var(--muted);
  padding: 14px;
  text-align: center;
}

.dashboard-analytics-card {
  margin-top: var(--card-gap);
}

.dashboard-analytics-status {
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 10px;
}

.dashboard-analytics-status.is-warning {
  color: #a15c16;
}

.dashboard-analytics-status.is-error {
  color: var(--danger);
}

.dashboard-analytics-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.dashboard-analytics-metric {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f8fafc;
  padding: 10px;
}

.dashboard-analytics-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dashboard-analytics-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1;
}

.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 12px;
}

.dashboard-analytics-grid h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.dashboard-analytics-list {
  display: grid;
  gap: 6px;
}

.dashboard-analytics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  padding: 8px 10px;
}

.dashboard-analytics-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dashboard-analytics-row strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.dashboard-analytics-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: var(--muted);
  padding: 12px;
  text-align: center;
  font-size: 12px;
}

#dashboard-patients-table {
  table-layout: auto;
}

#dashboard-patients-table th:nth-child(1),
#dashboard-patients-table td:nth-child(1) {
  width: 46%;
}

#dashboard-patients-table th:nth-child(2),
#dashboard-patients-table td:nth-child(2) {
  width: 25%;
}

#dashboard-patients-table th:nth-child(3),
#dashboard-patients-table td:nth-child(3) {
  width: 29%;
}

#dashboard-patients-table td:nth-child(1) {
  word-break: break-word;
}

@media (max-width: 1320px) {
  .dashboard-overview-grid #dashboard-patients-table th:nth-child(1),
  .dashboard-overview-grid #dashboard-patients-table td:nth-child(1) {
    width: 56%;
  }

  .dashboard-overview-grid #dashboard-patients-table th:nth-child(2),
  .dashboard-overview-grid #dashboard-patients-table td:nth-child(2) {
    display: none;
  }

  .dashboard-overview-grid #dashboard-patients-table th:nth-child(3),
  .dashboard-overview-grid #dashboard-patients-table td:nth-child(3) {
    width: 44%;
  }

  .dashboard-overview-grid #dashboard-patients-table .table-actions {
    gap: 6px;
  }

  .dashboard-overview-grid #dashboard-patients-table .table-actions .btn-sm {
    width: 34px;
    height: 34px;
    padding: 0;
    gap: 0;
    font-size: 0;
  }

  .dashboard-overview-grid #dashboard-patients-table .table-actions .btn-sm i {
    font-size: 13px;
  }
}

@media (max-width: 1100px) {
  .dashboard-analytics-metrics,
  .dashboard-analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-analytics-metrics,
  .dashboard-analytics-grid {
    grid-template-columns: 1fr;
  }
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.recent-patients-table .dataTables_info {
  color: var(--muted);
}

.recent-patients-table .dataTables_paginate {
  display: none;
}

.recent-patients-table.is-searching .dataTables_paginate {
  display: block;
}

.section-kicker {
  margin: 0 0 3px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.compliance-card {
  margin-bottom: 20px;
}

.compliance-page-card {
  margin-bottom: 18px;
}

.compliance-header,
.compliance-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.compliance-header h3 {
  margin: 0;
}

.compliance-copy {
  margin: 12px 0 18px;
  max-width: 840px;
  color: var(--muted);
  line-height: 1.55;
}

.compliance-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.compliance-status-ok {
  color: #136a43;
  background: #e7f7ee;
  border: 1px solid #cdeedb;
}

.compliance-status-warning,
.compliance-status-loading {
  color: #8a5f00;
  background: #fff4d9;
  border: 1px solid #ffe3a3;
}

.compliance-status-attention {
  color: #b42318;
  background: #fde8e8;
  border: 1px solid #f7c2c2;
}

.compliance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr);
  gap: 18px;
}

.compliance-grid h4 {
  margin: 0 0 10px;
  color: #344054;
  font-size: 14px;
}

.compliance-list {
  display: grid;
  gap: 10px;
}

.compliance-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcff;
}

.compliance-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compliance-item strong,
.compliance-item span,
.compliance-item small {
  display: block;
}

.compliance-item strong {
  font-size: 13px;
  color: var(--ink);
}

.compliance-item span,
.compliance-item small,
.compliance-placeholder,
.compliance-footer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.compliance-item small {
  margin-top: 2px;
}

.compliance-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.compliance-note-card {
  max-width: 920px;
}

.compliance-note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.pedigree-data-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

#people-table tbody tr {
  cursor: pointer;
}

#people-table tbody tr.is-selected td {
  background: #eef4ff !important;
}

.person-detail-card {
  position: sticky;
  top: 16px;
}

.person-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 12px;
}

.person-detail-grid span,
.person-detail-block .muted {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}

.person-detail-grid strong {
  font-size: 14px;
  font-weight: 500;
  word-break: break-word;
}

.person-detail-block {
  margin: 12px 0;
}

.person-detail-block p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

.webform-clinical-card {
  margin-top: 20px;
}

.clinical-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.clinical-card-header h3,
.clinical-card-header p {
  margin: 0;
}

.clinical-card-header p {
  margin-top: 4px;
}

.clinical-empty {
  color: var(--muted);
  font-size: 14px;
}

.clinical-summary-body {
  display: grid;
  gap: 18px;
}

.clinical-overview,
.clinical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.clinical-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.clinical-field {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcff;
  min-width: 0;
}

.clinical-field span,
.clinical-list-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.clinical-field strong,
.clinical-list-item strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

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

.clinical-list-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.clinical-json {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.clinical-json summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 500;
  font-size: 13px;
}

.clinical-json pre {
  margin: 12px 0 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #0f1324;
  color: #eef4ff;
  font-size: 12px;
  line-height: 1.45;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.profile-card-header,
.two-factor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-card-header h3,
.two-factor-panel h4,
.two-factor-recovery h4 {
  margin: 0;
}

.profile-detail-grid {
  display: grid;
  gap: 12px;
}

.profile-detail-grid strong {
  display: block;
  margin-top: 2px;
  font-weight: 500;
}

.profile-help-text {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.profile-security-card {
  display: grid;
  gap: 14px;
}

.two-factor-alert {
  border: 1px solid #ffe3a3;
  background: #fff8e8;
  color: #806000;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.two-factor-setup,
.two-factor-panel,
.two-factor-recovery {
  border: 1px solid var(--border);
  background: var(--soft);
  border-radius: 10px;
  padding: 12px;
}

.two-factor-setup {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.two-factor-qr-wrap {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.two-factor-qr {
  width: 208px;
  min-height: 208px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.two-factor-qr img,
.two-factor-qr canvas {
  display: block;
}

.two-factor-qr-help {
  max-width: 220px;
  text-align: center;
  line-height: 1.35;
}

.two-factor-qr-help strong,
.two-factor-qr-help span {
  display: block;
}

.two-factor-qr-help strong {
  font-size: 13px;
  font-weight: 500;
}

.two-factor-qr-help span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.two-factor-setup label,
.two-factor-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.two-factor-form {
  display: grid;
  gap: 10px;
}

.two-factor-code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.two-factor-recovery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.two-factor-recovery-header .muted {
  margin: 6px 0 0;
  max-width: 620px;
  line-height: 1.45;
}

.two-factor-recovery-warning {
  margin-bottom: 10px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.two-factor-code-grid code {
  display: block;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: "Space Grotesk", monospace;
  font-size: 13px;
}

.two-factor-danger {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.two-factor-danger summary {
  cursor: pointer;
  color: var(--danger);
  font-weight: 500;
}

@media (max-width: 720px) {
  .two-factor-setup {
    justify-content: center;
  }

  .two-factor-recovery-header {
    display: grid;
  }
}

.calendar-topbar {
  align-items: flex-start;
}

.calendar-topbar h2 {
  margin: 0;
  font-size: 28px;
}

.calendar-intro {
  margin: 6px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.calendar-shell {
  padding: var(--card-pad);
}

.calendar-toolbar,
.calendar-agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.calendar-toolbar h3,
.calendar-agenda-header h3 {
  margin: 0;
}

.calendar-month-controls,
.calendar-legend,
.calendar-event-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.calendar-legend span,
.calendar-event-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.calendar-dot.is-appointment,
.calendar-event-chip.is-appointment,
.calendar-agenda-item.is-appointment {
  --event-color: #2d6cdf;
  --event-bg: #edf4ff;
}

.calendar-dot.is-pedigree,
.calendar-event-chip.is-pedigree,
.calendar-agenda-item.is-pedigree {
  --event-color: #1f9d73;
  --event-bg: #eaf8f1;
}

.calendar-dot.is-webform,
.calendar-event-chip.is-webform,
.calendar-agenda-item.is-webform {
  --event-color: #a15c16;
  --event-bg: #fff4e5;
}

.calendar-dot {
  background: var(--event-color, var(--muted));
}

.calendar-feedback {
  min-height: 16px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.calendar-feedback.is-error {
  color: var(--danger);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(286px, 330px);
  gap: var(--card-gap);
  align-items: start;
}

.calendar-grid-wrap,
.calendar-agenda {
  min-width: 0;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 5px;
}

.calendar-weekdays span {
  padding: 4px;
}

.calendar-grid {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #eef2f8;
  gap: 1px;
}

.calendar-day {
  min-height: 112px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-day.is-outside {
  background: #f8fafc;
  color: #98a2b3;
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(45, 108, 223, 0.32);
}

.calendar-day-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 500;
}

.calendar-day.is-today .calendar-day-number {
  background: var(--brand);
  color: #fff;
}

.calendar-day-events {
  display: grid;
  gap: 5px;
}

.calendar-event-chip {
  width: 100%;
  border: 0;
  border-left: 3px solid var(--event-color, var(--brand));
  border-radius: 7px;
  background: var(--event-bg, #edf4ff);
  color: #1f2937;
  cursor: default;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  padding: 4px 6px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-chip.is-editable {
  cursor: pointer;
}

.calendar-event-more {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.calendar-agenda {
  position: sticky;
  top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px;
}

.calendar-agenda-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.calendar-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.calendar-stat {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  padding: 9px;
}

.calendar-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.calendar-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.calendar-agenda-list {
  display: grid;
  gap: 8px;
  max-height: 660px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.calendar-agenda-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--event-color, var(--brand));
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  min-width: 0;
}

.calendar-agenda-item.is-editable {
  cursor: pointer;
}

.calendar-agenda-item.is-editable:hover,
.calendar-agenda-item.is-editable:focus {
  border-color: #cbd5f5;
  box-shadow: 0 10px 24px rgba(19, 27, 51, 0.08);
  outline: none;
}

.calendar-agenda-item h4 {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.calendar-agenda-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.calendar-event-type {
  color: var(--event-color, var(--brand));
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.calendar-event-notes {
  margin-top: 8px !important;
}

.calendar-event-link,
.calendar-event-delete {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 9px;
}

.calendar-event-delete {
  color: var(--danger);
  cursor: pointer;
}

.calendar-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: var(--muted);
  padding: 14px;
  text-align: center;
}

.calendar-modal-content {
  max-width: 820px;
}

.calendar-modal-content .modal-actions .btn-danger {
  margin-right: auto;
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-group input[type="datetime-local"] {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
}

.calendar-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: #344054;
  font-size: 13px;
  font-weight: 500;
}

.calendar-checkbox input {
  width: 16px;
  height: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.patient-detail-topbar {
  align-items: flex-start;
}

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

.patient-detail-feedback {
  min-height: 20px;
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.patient-detail-feedback.is-success { color: #1f7a4b; }
.patient-detail-feedback.is-error { color: var(--danger); }
.patient-detail-feedback.is-info { color: var(--brand); }

.patient-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: var(--card-gap);
  align-items: start;
}

.patient-detail-main,
.patient-detail-side {
  display: grid;
  gap: var(--card-gap);
}

.patient-detail-side {
  position: sticky;
  top: 14px;
}

.patient-detail-card {
  box-shadow: none;
}

.patient-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.patient-section-header h3 {
  margin: 0;
}

.patient-detail-tight-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.patient-cancer-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.patient-cancer-row {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(180px, 1fr) minmax(120px, 150px) minmax(120px, 150px) minmax(160px, 1fr) 40px;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fbfcff;
}

.patient-cancer-remove {
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
}

.patient-summary-grid,
.patient-canrisk-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.patient-summary-grid div,
.patient-canrisk-metrics div {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
}

.patient-summary-grid span,
.patient-canrisk-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.patient-summary-grid strong,
.patient-canrisk-metrics strong {
  color: var(--text);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.patient-events-card .patient-section-header {
  align-items: flex-start;
}

.patient-events-card .patient-section-header h3 {
  margin-bottom: 3px;
}

.patient-events-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.patient-events-list {
  display: grid;
  gap: 7px;
  max-height: 280px;
  overflow-y: auto;
}

.patient-event-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 9px;
  background: #fbfcff;
  padding: 9px 10px;
}

.patient-event-item strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.patient-event-date {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
}

.patient-events-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  padding: 14px;
  text-align: center;
}

.patient-family-selector {
  display: grid;
  gap: 10px;
}

.patient-family-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcff;
  padding: 10px 12px;
}

.patient-family-selected strong,
.patient-family-selected span,
.patient-family-selected small {
  display: block;
}

.patient-family-selected span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.patient-family-selected strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.patient-family-selected small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.patient-family-review-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.patient-family-review-actions .badge {
  margin-top: 0;
}

.patient-family-clinical {
  display: grid;
  gap: 12px;
}

.patient-family-subsection {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.patient-family-subsection h4 {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

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

.app-context-drawer .patient-family-actions {
  display: none;
}

.patient-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.patient-report-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.patient-report-preview iframe {
  display: block;
  width: 100%;
  height: 520px;
  border: 0;
  background: #fff;
}

.patient-webform-metrics,
.patient-document-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.patient-webform-metrics div,
.patient-document-metrics div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.patient-webform-metrics span,
.patient-document-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 5px;
}

.patient-webform-metrics strong,
.patient-document-metrics strong {
  color: var(--text);
  font-size: 15px;
}

.patient-document-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.patient-document-select-grid .form-group {
  min-width: 0;
}

.patient-document-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.patient-document-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 8px 10px;
}

.patient-document-preview-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.patient-document-preview-header span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.patient-document-preview-header strong {
  display: block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.patient-document-preview iframe {
  display: block;
  width: 100%;
  height: 460px;
  border: 0;
  background: #fff;
}

.patient-document-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 10px;
}

.patient-document-note i {
  color: var(--brand);
  margin-top: 2px;
}

.patient-canrisk-json {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.patient-canrisk-json summary {
  color: var(--brand);
  cursor: pointer;
  font-weight: 500;
}

.patient-canrisk-json pre {
  max-height: 520px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .app-header-inner {
    height: auto;
    min-height: var(--app-header-height);
    padding: 10px 18px 0;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    gap: 8px 14px;
  }
  .app-primary-nav {
    grid-column: 1 / -1;
    min-height: 44px;
    margin: 0 -18px;
    padding: 0 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .app-primary-nav::-webkit-scrollbar {
    display: none;
  }
  .app-account-menu {
    justify-self: end;
  }
  .main {
    padding: 20px;
  }
  .app-footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding-right: 18px;
    padding-left: 18px;
  }
  .app-footer-links {
    justify-content: flex-start;
  }
  .module-context-bar {
    padding-right: 18px;
    padding-left: 18px;
  }
  .module-content {
    padding: 18px;
  }
  .editor-patient-bar {
    min-height: 92px;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-rows: 50px 42px;
    gap: 0 14px;
    padding: 0 18px;
  }
  .patient-workspace-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .patient-workspace-tabs a:first-child {
    padding-left: 0;
  }
  .patient-workspace-tabs a:first-child::after {
    left: 0;
  }
  .editor-shell-toolbar {
    padding-right: 18px;
    padding-left: 18px;
    overflow-x: auto;
  }
  .editor-toolbar-group {
    flex: 0 0 auto;
  }
  .sidebar {
  min-height: 100vh; flex-direction: row; flex-wrap: wrap; }
  .compliance-grid {
    grid-template-columns: 1fr;
  }
  .pedigree-data-layout {
    grid-template-columns: 1fr;
  }
  .person-detail-card {
    position: static;
  }
  .clinical-card-header {
    flex-direction: column;
  }
  .dashboard-overview-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-calendar-card {
    position: static;
  }
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .calendar-agenda {
    position: static;
  }
  .patient-detail-grid {
    grid-template-columns: 1fr;
  }
  .patient-detail-page {
    --patient-context-height: 92px;
  }
  .patient-detail-side {
    position: static;
  }
  .patient-cancer-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .patient-cancer-remove {
    width: auto;
  }
}

@media (max-width: 820px) {
  :root {
    --context-drawer-width: min(440px, 100vw);
  }
  .app-context-drawer .form-grid,
  .app-context-drawer .patient-detail-tight-grid,
  .app-context-drawer .patient-cancer-row,
  .calendar-drawer-content .form-grid {
    grid-template-columns: 1fr;
  }
  .app-context-drawer .patient-webform-metrics,
  .app-context-drawer .patient-document-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .patient-document-select-grid {
    grid-template-columns: 1fr;
  }
  .app-shell--workspace .app-drawer-backdrop {
    display: block;
  }
}

@media (max-width: 640px) {
  .app-header-inner {
    padding-right: 14px;
    padding-left: 14px;
  }
  .app-brand {
    font-size: 18px;
  }
  .app-brand img {
    width: 27px;
    height: 27px;
  }
  .app-account-menu summary {
    grid-template-columns: 34px 10px;
    padding: 5px 8px;
  }
  .app-account-summary {
    display: none;
  }
  .app-account-popover {
    width: min(290px, calc(100vw - 28px));
  }
  .app-primary-nav {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
  }
  .app-nav-link {
    padding-right: 12px;
    padding-left: 12px;
  }
  .app-nav-link::after {
    right: 12px;
    left: 12px;
  }
  .main {
    padding: 18px 14px;
  }
  .app-footer-inner {
    padding-right: 14px;
    padding-left: 14px;
  }
  .app-footer-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    white-space: normal;
  }
  .app-footer-links a {
    padding-right: 7px;
    padding-left: 7px;
  }
  .module-context-bar {
    padding-right: 14px;
    padding-left: 14px;
  }
  .module-content {
    padding: 14px;
  }
  .module-toolbar-label {
    max-width: 55vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .module-search {
    min-width: 220px;
  }
  .module-context-meta span {
    display: none;
  }
  .editor-patient-bar {
    padding-right: 14px;
    padding-left: 14px;
  }
  .editor-save-state span {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .editor-shell-toolbar {
    padding-right: 14px;
    padding-left: 14px;
  }
  .topbar { flex-direction: column; align-items: stretch; }
  .patient-detail-actions {
    width: 100%;
  }
  .patient-detail-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .patient-detail-tight-grid,
  .patient-summary-grid,
  .patient-canrisk-metrics,
  .patient-cancer-row {
    grid-template-columns: 1fr;
  }
  .calendar-shell {
    padding: 14px;
  }
  .calendar-weekdays {
    display: none;
  }
  .calendar-grid {
    grid-template-columns: 1fr;
  }
  .calendar-day {
    min-height: auto;
  }
  .calendar-day.is-outside {
    display: none;
  }
  .calendar-stat-grid {
    grid-template-columns: 1fr;
  }
}
.btn-sm {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11px;
}

.dataTables_wrapper {
  font-size: 14px;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 5px 8px;
  min-height: 30px;
}

table.dataTable {
  margin-top: 6px !important;
  margin-bottom: 8px !important;
}

table.dataTable thead th,
table.dataTable thead td,
table.dataTable tbody th,
table.dataTable tbody td {
  padding: var(--compact-row-pad-y) var(--compact-row-pad-x) !important;
}

table.dataTable thead th,
table.dataTable thead td {
  font-size: 13px;
}

table.dataTable tbody td {
  line-height: 1.25;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: 13px;
}

.dataTables_wrapper .dataTables_info {
  padding-top: 8px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--control-radius) !important;
  border: 1px solid transparent !important;
  padding: 5px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand) !important;
}
.muted { color: var(--muted); }

.data-management-toolbar {
  justify-content: space-between;
}

.data-management-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: var(--card-gap);
}

.data-metric-card,
.data-derived-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px 12px;
}

.data-metric-card span,
.data-derived-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.data-metric-card strong,
.data-derived-item strong {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
}

.data-metric-card em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.data-management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.48fr);
  gap: var(--card-gap);
  align-items: start;
  margin-bottom: var(--card-gap);
}

.data-management-card {
  min-width: 0;
}

.data-management-free-content {
  max-width: 980px;
}

.data-management-free-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.62fr);
  gap: var(--card-gap);
  align-items: stretch;
}

.data-management-basic-export,
.data-management-upgrade-card {
  min-height: 100%;
}

.data-management-card-copy {
  margin: 0 0 14px;
  max-width: 640px;
  color: var(--muted);
  line-height: 1.45;
}

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

.data-derived-item {
  padding: 9px 10px;
}

.data-derived-item strong {
  font-size: 20px;
}

.data-source-status {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.data-source-status span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 9px;
}

.data-source-status .is-ok i {
  color: #22c55e;
}

.data-source-status .is-warning i {
  color: #f59e0b;
}

.data-export-list {
  display: grid;
  gap: 8px;
}

.data-export-link,
.data-record,
.data-search-section-list a,
.data-quality-records a,
.data-quality-records div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.data-export-link {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
}

.data-export-link i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand);
}

.data-export-link span {
  font-weight: 500;
}

.data-export-link strong {
  color: var(--muted);
  font-size: 12px;
}

.data-export-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  background: #f7faff;
  color: #536078;
  font-size: 12px;
  line-height: 1.4;
}

.data-export-note i {
  margin-top: 2px;
  color: var(--brand);
}

.data-quality-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.data-quality-item {
  min-width: 0;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  background: #fffaf0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 10px;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  width: 100%;
}

.data-quality-item.is-danger {
  border-color: #fecaca;
  border-left-color: #ef4444;
  background: #fff5f5;
}

.data-quality-item.is-clear {
  border-color: #bbf7d0;
  border-left-color: #22c55e;
  background: #f0fdf4;
}

.data-quality-item:hover,
.data-quality-item.is-active {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.data-quality-item.is-active {
  outline: 2px solid rgba(37, 99, 235, 0.18);
}

.data-quality-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.data-quality-heading span {
  color: var(--text);
  font-weight: 500;
}

.data-quality-heading strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
}

.data-quality-item p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin: 6px 0 0;
}

.data-quality-item small {
  color: var(--brand);
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  margin-top: 8px;
}

.data-quality-records {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.data-quality-records a,
.data-quality-records div {
  display: block;
  padding: 9px;
}

.data-quality-records .is-reviewed {
  opacity: 0.66;
}

.data-review-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.data-review-workspace {
  margin-bottom: var(--card-gap);
}

.data-review-statusbar {
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 500;
  gap: 12px;
  justify-content: space-between;
  margin: -4px -4px 14px;
  padding: 0 4px 14px;
}

.data-review-statusbar .is-error {
  color: var(--danger);
}

.data-review-records {
  display: grid;
  gap: 8px;
}

.data-review-record {
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
}

.data-review-record.is-reviewed {
  border-left-color: #22c55e;
  background: #f8fffb;
}

.data-review-record-main {
  min-width: 0;
}

.data-review-record-status {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.data-review-record-status span,
.data-review-record-status strong {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
}

.data-review-record-status span {
  background: rgba(37, 99, 235, 0.09);
  color: var(--brand);
}

.data-review-record-status strong {
  background: #eef2f7;
  color: var(--muted);
}

.data-review-record.is-reviewed .data-review-record-status strong {
  background: #dcfce7;
  color: #15803d;
}

.data-review-record h4 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
  margin: 0;
}

.data-review-record p,
.data-review-record em {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.data-review-record-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.data-quality-records strong,
.data-quality-records em,
.data-record strong,
.data-record span,
.data-search-section-list strong,
.data-search-section-list span {
  display: block;
  min-width: 0;
}

.data-quality-records strong,
.data-record strong,
.data-search-section-list strong {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-quality-records em,
.data-record span,
.data-search-section-list span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.data-record-list {
  display: grid;
  gap: 8px;
}

.data-record {
  display: block;
  padding: 10px;
}

.data-search-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.data-search-results section {
  min-width: 0;
}

.data-search-results h4 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 8px;
}

.data-search-section-list {
  display: grid;
  gap: 8px;
}

.data-search-section-list a {
  display: block;
  padding: 10px;
}

.data-management-empty,
.data-management-skeleton {
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  padding: 16px;
  text-align: center;
}

.feature-lock-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  max-width: 760px;
  padding: 18px;
}

.feature-lock-mark,
.feature-lock-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--brand);
  flex: 0 0 auto;
}

.feature-lock-panel h2,
.feature-lock-card h3 {
  margin: 0 0 6px;
}

.feature-lock-panel p:not(.section-kicker),
.feature-lock-card p:not(.section-kicker) {
  margin: 0;
  color: #5f6878;
  line-height: 1.45;
}

.feature-lock-actions {
  grid-column: 2;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.feature-lock-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-style: dashed;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

@media (max-width: 1180px) {
  .data-management-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .data-management-grid {
    grid-template-columns: 1fr;
  }
  .data-management-free-grid {
    grid-template-columns: 1fr;
  }
  .data-quality-list,
  .data-search-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .data-management-metrics,
  .data-derived-grid,
  .data-quality-list,
  .data-search-results {
    grid-template-columns: 1fr;
  }
  .data-review-record {
    grid-template-columns: 1fr;
  }
  .data-review-record-actions {
    justify-content: flex-start;
  }
}

/* ---- Support tickets ---- */
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}
.ticket-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.ticket-table th, .ticket-table td { border-bottom: 1px solid var(--border); padding: 9px 8px; text-align: left; vertical-align: top; }
.ticket-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ticket-table tbody tr { cursor: pointer; }
.ticket-table tbody tr:hover { background: #f8fafc; }
.ticket-table td .muted { display: block; font-size: 12px; }

.ticket-status { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.ticket-status-open { background: #dbeafe; color: #1e40af; }
.ticket-status-answered { background: #fef3c7; color: #92400e; }
.ticket-status-closed { background: #f1f5f9; color: #475569; }

.ticket-scope .btn.is-active { border-color: var(--brand); color: var(--brand); font-weight: 600; }

.ticket-field { margin-bottom: 12px; }
.ticket-field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.ticket-field input, .ticket-field select, .ticket-field textarea { width: 100%; }

.ticket-env {
  display: flex; gap: 16px; flex-wrap: wrap;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; color: var(--muted); margin-bottom: 14px;
}

.ticket-thread { display: grid; gap: 12px; margin: 16px 0; }
.ticket-msg { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fff; }
.ticket-msg.is-staff { background: #f0f7ff; border-color: #bfdbfe; }
.ticket-msg header { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; flex-wrap: wrap; }
.ticket-msg header .muted { font-size: 12px; }
.ticket-msg-body { line-height: 1.55; overflow-wrap: anywhere; }

.ticket-reply-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ticket-reply-form label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.ticket-reply-form textarea { width: 100%; }
.ticket-reply-actions { margin-top: 8px; }
.ticket-closed-note { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.ticket-admin-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ticket-status-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket-status-form label { font-weight: 600; font-size: 13px; margin: 0; }
.ticket-status-form select { width: auto; }

@media (max-width: 900px) {
  .ticket-layout { grid-template-columns: 1fr; }
}

/* ================= Help centre: manual + knowledge base ================= */
/* Help centre (2026-09 redesign): big search with suggestions, a featured "start here" band,
   two-column topic cards with two articles each, a side panel, and FAQ accordions. */
.kb-crumbs { display: flex; align-items: center; gap: 8px; margin: 2px 0 18px; font-size: 13px; color: var(--muted); }
.kb-crumbs a { color: var(--muted); text-decoration: none; }
.kb-crumbs a:hover { color: var(--brand); }
.kb-crumbs > i { font-size: 10px; opacity: .6; }
.kb-crumbs span { color: var(--ink); }

.kb-hero { text-align: center; padding: 10px 0 6px; margin-bottom: 22px; }
.kb-hero h2 { margin: 0 0 6px; font-size: 32px; line-height: 1.15; }
.kb-hero p { margin: 0; color: var(--muted); font-size: 15px; }
.kb-hero-back { margin-left: 10px; color: var(--brand); text-decoration: none; font-weight: 600; }
.kb-hero-back:hover { text-decoration: underline; }

.kb-searchbox { position: relative; max-width: 940px; margin: 22px auto 0; display: flex; }
.kb-searchbox > i {
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 18px; pointer-events: none;
}
.kb-searchbox input {
  flex: 1 1 auto; min-width: 0; padding: 17px 44px 17px 56px;
  border: 1px solid var(--border); border-right: 0; border-radius: 12px 0 0 12px;
  font-size: 16px; background: #fff; color: var(--ink);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.kb-searchbox input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(45, 108, 223, 0.14); }
.kb-search-clear {
  position: absolute; right: 118px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; line-height: 1;
}
.kb-search-clear:hover { color: var(--ink); }
.kb-search-btn { border-radius: 0 12px 12px 0; padding: 0 26px; font-size: 15px; }

.kb-suggestions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; max-width: 940px; margin: 12px auto 0; font-size: 13px; color: var(--muted); }
.kb-suggestions button {
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.kb-suggestions button:hover { border-color: var(--brand); color: var(--brand); }

.kb-search-results { max-width: 720px; margin: 18px auto 0; text-align: left; display: grid; gap: 8px; }
.kb-search-count { margin: 0 0 2px; font-size: 12px; color: var(--muted); text-align: center; }
.kb-search-hit {
  display: block; padding: 12px 14px; border-radius: 12px;
  background: #fff; text-decoration: none; color: var(--ink);
  border: 1px solid var(--border); transition: transform .12s ease, box-shadow .12s ease;
}
.kb-search-hit:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12); }
.kb-search-hit strong { display: block; margin-bottom: 2px; }
.kb-hit-section { font-size: 11px; color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kb-hit-excerpt { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.kb-search-empty { background: #fff; border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); }
.kb-search-empty i { font-size: 26px; opacity: .4; }
.kb-search-empty p { margin: 10px 0 12px; }


/* Start-here band */
.kb-start {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 22px; margin-bottom: 26px;
  background: #eaf1ff; border: 1px solid #d4e1ff; border-radius: 14px;
  text-decoration: none; color: var(--ink);
}
.kb-start:hover { border-color: var(--brand); }
.kb-start-icon {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--brand); font-size: 26px;
}
.kb-start-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.kb-eyebrow { font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.kb-start-text strong { font-size: 18px; }
.kb-start-text small { color: var(--muted); font-size: 13.5px; }
.kb-start-btn { flex: 0 0 auto; white-space: nowrap; }

/* Main + side */
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.kb-h2 { margin: 0 0 14px; font-size: 24px; }
.kb-topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.kb-topic { padding: 18px 20px 14px; display: flex; flex-direction: column; }
.kb-topic-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.kb-topic-head h3 { margin: 0; font-size: 17px; }
.kb-topic-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.kb-section-icon {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: #eff4ff; color: var(--brand); font-size: 18px;
}
.kb-section-icon.is-faq { background: #fef3c7; color: #b45309; }

.kb-article-list { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; }
.kb-article-list a {
  display: flex; align-items: center; gap: 10px; position: relative;
  padding: 9px 26px 9px 8px; margin: 0 -8px;
  border-radius: 10px; text-decoration: none; color: var(--brand);
}
.kb-article-list a:hover { background: #f6f9ff; }
.kb-row-icon { flex: 0 0 auto; font-size: 15px; }
.kb-row-text { min-width: 0; }
.kb-article-title { display: block; font-weight: 500; }
.kb-article-summary { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.kb-article-chevron {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--border); font-size: 12px; transition: color .12s ease, transform .12s ease;
}
.kb-article-list a:hover .kb-article-chevron { color: var(--brand); transform: translate(2px, -50%); }
.kb-see-all {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  margin-top: 10px; padding: 4px 0;
  background: none; border: 0; cursor: pointer;
  color: var(--brand); font-weight: 600; font-size: 14px; text-decoration: none;
}
.kb-see-all:hover { text-decoration: underline; }
.kb-topic-full .kb-article-list a { padding-top: 11px; padding-bottom: 11px; }
.kb-topic-full .kb-article-list li + li { border-top: 1px solid var(--border); }

.kb-side { display: grid; gap: 16px; }
.kb-support { text-align: center; padding: 26px 20px 22px; }
.kb-support-icon {
  width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eff4ff; color: var(--brand); font-size: 28px;
}
.kb-support h3 { margin: 0 0 8px; font-size: 19px; }
.kb-support p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.kb-support-btn { width: 100%; justify-content: center; }
.kb-support-mail { display: block; margin-top: 10px; font-size: 12.5px; color: var(--muted); word-break: break-all; }
.kb-resources { padding: 20px; }
.kb-resources h3 { margin: 0 0 10px; font-size: 17px; }
.kb-resources ul { list-style: none; margin: 0; padding: 0; }
.kb-resources li + li { border-top: 1px solid var(--border); }
.kb-resources a {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  text-decoration: none; color: var(--ink); font-size: 14px;
}
.kb-resources a > i:first-child { width: 20px; text-align: center; color: var(--brand); }
.kb-resources a:hover span { color: var(--brand); }
.kb-ext { margin-left: auto; font-size: 12px; color: var(--muted); }
.kb-manage { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-decoration: none; }
.kb-manage:hover { color: var(--brand); }

/* FAQ accordions */
.kb-faq { margin-top: 22px; padding: 22px 24px 18px; }
.kb-faq-item { border-top: 1px solid var(--border); }
.kb-faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 4px; cursor: pointer; list-style: none; font-size: 15.5px; font-weight: 500;
}
.kb-faq-item summary::-webkit-details-marker { display: none; }
.kb-faq-item summary i { color: var(--brand); font-size: 14px; transition: transform .15s ease; }
.kb-faq-item[open] summary i { transform: rotate(45deg); }
.kb-faq-body { padding: 0 4px 16px; font-size: 14.5px; }
.kb-faq-toggle { margin-top: 8px; }

.kb-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.kb-empty i { font-size: 30px; opacity: .35; }
.kb-empty p { margin: 12px 0; }
.kb-foot { margin: 26px 0 0; font-size: 12.5px; }

@media (max-width: 1000px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-side { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 720px) {
  .kb-hero h2 { font-size: 26px; }
  .kb-searchbox { flex-wrap: wrap; }
  .kb-searchbox input { border-right: 1px solid var(--border); border-radius: 12px; }
  .kb-search-clear { right: 12px; }
  .kb-search-btn { display: none; }
  .kb-topics { grid-template-columns: 1fr; }
  .kb-start { flex-wrap: wrap; }
  .kb-start-btn { width: 100%; justify-content: center; }
}

/* Article modal */
body.kb-modal-open { overflow: hidden; }
.kb-article-modal-content { max-width: 780px; width: 96vw; max-height: 88vh; display: flex; flex-direction: column; }
.kb-article-header { align-items: flex-start; }
.kb-article-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kb-article-heading h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.kb-article-eyebrow {
  display: block; font-size: 11px; font-weight: 700; color: var(--brand);
  text-transform: uppercase; letter-spacing: .05em;
}
.kb-article-modal-content .modal-body { overflow-y: auto; }
.kb-article-loading { color: var(--muted); padding: 20px 0; text-align: center; }
.kb-modal-error { color: var(--danger); }

/* Rendered markdown */
.kb-body { line-height: 1.65; }
.kb-body > *:first-child { margin-top: 0; }
.kb-body h2 { font-size: 19px; margin: 24px 0 8px; }
.kb-body h3 { font-size: 16px; margin: 20px 0 6px; }
.kb-body h4 { font-size: 14px; margin: 16px 0 6px; }
.kb-body p { margin: 0 0 12px; }
.kb-body ul, .kb-body ol { margin: 0 0 12px 22px; padding: 0; }
.kb-body li { margin-bottom: 5px; }
.kb-body a { color: var(--brand); }
.kb-body .kb-summary { color: var(--muted); font-size: 14.5px; margin-bottom: 16px; }
.kb-body blockquote {
  margin: 0 0 14px; padding: 11px 15px;
  border-left: 3px solid var(--brand); border-radius: 0 8px 8px 0;
  background: #f6f9ff;
}
.kb-body blockquote p:last-child { margin-bottom: 0; }
.kb-body code {
  background: #f1f5f9; padding: 1px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
}
.kb-code { background: #0f172a; color: #e2e8f0; padding: 13px 15px; border-radius: 10px; overflow-x: auto; margin: 0 0 14px; }
.kb-code code { background: none; color: inherit; padding: 0; }
.kb-image { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; margin: 8px 0; }
.kb-table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; }
.kb-table th, .kb-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.kb-table th { background: #f8fafc; font-weight: 700; }
.kb-body hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.kb-helpful {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px;
}
.kb-helpful-thanks { color: var(--success); font-weight: 600; }

/* Admin authoring */
.kb-admin-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kb-row-actions { white-space: nowrap; }
.kb-row-actions .btn { margin-left: 4px; }
.kb-admin-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.kb-admin-table th, .kb-admin-table td { border-bottom: 1px solid var(--border); padding: 10px 8px; text-align: left; vertical-align: middle; }
.kb-admin-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kb-admin-row { cursor: pointer; }
.kb-admin-row:hover { background: #f8fafc; }
.kb-status { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.kb-status-published { background: #dcfce7; color: #166534; }
.kb-status-draft { background: #f1f5f9; color: #475569; }
.kb-toolbar-hint { font-size: 12px; margin: -4px 0 10px; }
.kb-toolbar-hint code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: .95em; }

.kb-modal-content { max-width: 1080px; width: 96vw; }
.kb-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kb-field-wide { grid-column: 1 / -1; }
.kb-field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.kb-field input, .kb-field select { width: 100%; }
.kb-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.kb-toolbar .tool-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 9px; cursor: pointer; color: var(--ink); }
.kb-toolbar .tool-btn:hover { border-color: var(--brand); color: var(--brand); }
.kb-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kb-pane label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.kb-pane textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.kb-preview { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fff; min-height: 300px; overflow-y: auto; }

@media (max-width: 900px) {
  .kb-split { grid-template-columns: 1fr; }
  .kb-hero { padding: 26px 16px; }
}

/* ---- Admin: email deliverability ---- */
.email-health { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.email-health.is-ok { background: #dcfce7; color: #166534; }
.email-health.is-warn { background: #fef3c7; color: #92400e; }
.email-health.is-bad { background: #fee2e2; color: #991b1b; }

.email-config-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.email-config-item { font-size: 12px; border-radius: 8px; padding: 4px 10px; border: 1px solid var(--border); }
.email-config-item.is-set { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.email-config-item.is-missing { color: #991b1b; border-color: #fecaca; background: #fef2f2; }

.email-test-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.email-test-form label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }
.email-test-form input { min-width: 260px; }

.email-log-details { margin-top: 10px; }
.email-log-details summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.email-log-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.email-log-table th, .email-log-table td { border-bottom: 1px solid var(--border); padding: 7px 8px; text-align: left; vertical-align: top; }
.email-log-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.email-status { font-weight: 600; white-space: nowrap; }
.email-status.is-ok { color: #166534; }
.email-status.is-bad { color: #991b1b; }
.email-error { font-size: 11px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

/* Admin page tabs. Cards carry data-admin-tab; only the active tab's cards are shown. */
.admin-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.admin-tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #737d91;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

.admin-tabs a::after {
  content: '';
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

.admin-tabs a:hover,
.admin-tabs a.is-active {
  color: var(--brand-dark);
}

.admin-tabs a.is-active::after {
  background: var(--brand);
}

.admin-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.admin-tab-badge.is-attention {
  background: #eff6ff;
  color: #1e40af;
}

.admin-tab-badge.is-warn {
  background: #fff7ed;
  color: #9a3412;
}

[data-admin-tab][hidden] {
  display: none !important;
}

/* Row actions in admin tables: several small forms side by side. */
.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-row-actions form {
  margin: 0;
}

/* Signed-out header on the public pages (downloads, help): Criar conta beside Entrar. */
.app-guest-actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.app-guest-actions .btn-ghost { color: #fff; background: transparent; border-color: rgba(255, 255, 255, 0.35); }
.app-guest-actions .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* "Check your spam" note under the access-request and waitlist confirmations (request-access.php). */
.spam-note { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff8eb; border: 1px solid #f5d9a8; color: #7a4a05; font-size: 13px; line-height: 1.5; }
.spam-note i { margin-top: 3px; }
