:root,
html[data-theme="dark"] {
  --bg: #07110f;
  --bg-2: #101817;
  --bg-3: #17151d;
  --surface: rgba(16, 24, 23, 0.78);
  --surface-2: rgba(21, 29, 28, 0.9);
  --surface-3: rgba(28, 34, 39, 0.94);
  --border: rgba(211, 223, 218, 0.14);
  --border-strong: rgba(52, 211, 153, 0.38);
  --text: #f8fafc;
  --text-soft: #d3dfda;
  --muted: #9eb0ab;
  --faint: #70817d;
  --cyan: #2dd4bf;
  --teal: #34d399;
  --blue: #818cf8;
  --rose: #fb7185;
  --red: #ef4444;
  --amber: #fbbf24;
  --green: #22c55e;
  --purple: #a78bfa;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --glow: 0 18px 54px rgba(52, 211, 153, 0.14);
  --page-bg:
    linear-gradient(115deg, rgba(45, 212, 191, 0.16), transparent 34%),
    linear-gradient(245deg, rgba(251, 191, 36, 0.1), transparent 32%),
    linear-gradient(135deg, #07110f 0%, #101817 46%, #17151d 100%);
  --control-bg: rgba(28, 36, 34, 0.78);
  --control-hover-bg: rgba(42, 52, 49, 0.94);
  --input-bg: rgba(30, 40, 43, 0.78);
  --panel-tint: rgba(21, 29, 28, 0.64);
  --sidebar-bg: rgba(12, 18, 17, 0.92);
  --topbar-bg: rgba(11, 17, 16, 0.86);
  --modal-bg: linear-gradient(180deg, rgba(22, 31, 29, 0.98), rgba(10, 16, 15, 0.98));
  --modal-header-bg: rgba(20, 29, 27, 0.96);
  --overlay-bg: rgba(4, 10, 9, 0.74);
  --toast-bg: rgba(16, 24, 23, 0.94);
  --row-hover: rgba(52, 211, 153, 0.055);
  --subtle-accent: rgba(52, 211, 153, 0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-width: 264px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f7faf6;
  --bg-2: #edf7f0;
  --bg-3: #f5eee8;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: rgba(255, 255, 255, 0.94);
  --surface-3: rgba(249, 252, 248, 0.96);
  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(5, 150, 105, 0.34);
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --faint: #8a9aac;
  --cyan: #0f766e;
  --teal: #059669;
  --blue: #4f46e5;
  --rose: #e11d48;
  --red: #dc2626;
  --amber: #b45309;
  --green: #16a34a;
  --purple: #7c3aed;
  --shadow: 0 20px 56px rgba(15, 23, 42, 0.11);
  --glow: 0 18px 54px rgba(5, 150, 105, 0.12);
  --page-bg:
    linear-gradient(115deg, rgba(16, 185, 129, 0.14), transparent 34%),
    linear-gradient(245deg, rgba(245, 158, 11, 0.14), transparent 32%),
    linear-gradient(135deg, #fbfefb 0%, #edf7f0 50%, #f8f1eb 100%);
  --control-bg: rgba(255, 255, 255, 0.76);
  --control-hover-bg: rgba(255, 255, 255, 0.96);
  --input-bg: rgba(255, 255, 255, 0.82);
  --panel-tint: rgba(255, 255, 255, 0.64);
  --sidebar-bg: rgba(255, 255, 255, 0.88);
  --topbar-bg: rgba(255, 255, 255, 0.84);
  --modal-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 252, 0.98));
  --modal-header-bg: rgba(255, 255, 255, 0.94);
  --overlay-bg: rgba(15, 23, 42, 0.2);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --row-hover: rgba(5, 150, 105, 0.06);
  --subtle-accent: rgba(5, 150, 105, 0.09);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  transition: background-color 0.32s ease;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page-bg);
  transition: background 0.32s ease, color 0.32s ease;
}

body.public-page,
body.auth-page {
  overflow-x: hidden;
}

a {
  color: inherit;
}

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

button {
  border: 0;
}

::selection {
  background: rgba(6, 182, 212, 0.32);
}

.theme-toggle {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text-soft);
  background: var(--control-bg);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--control-hover-bg);
  box-shadow: var(--glow);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .stat-card,
  .feature-card,
  .auth-brand,
  .auth-card,
  .loading-card,
  .sidebar,
  .topbar,
  .topbar-user,
  .field input,
  .field select,
  .field textarea,
  .search-field input {
    transition: background 0.32s ease, background-color 0.32s ease, border-color 0.24s ease, color 0.24s ease, box-shadow 0.32s ease;
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.24);
  border-radius: 999px;
}

.ct-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.ct-logo-full {
  min-height: 58px;
}

.ct-logo-image {
  display: block;
  width: clamp(132px, 13vw, 176px);
  height: 58px;
  object-fit: contain;
  object-position: left center;
  border-radius: 8px;
}

.auth-card-logo {
  width: 154px;
  height: 58px;
  margin: 0;
  object-position: left center;
}

.ct-logo-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--amber));
  color: white;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--teal) 28%, transparent);
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.ct-logo-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 44%, rgba(255, 255, 255, 0.22));
}

.ct-logo-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.ct-logo-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.ct-logo-sub {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--control-bg);
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--control-hover-bg);
}

.btn.primary {
  background: linear-gradient(135deg, var(--teal), var(--cyan) 56%, var(--amber));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--teal) 28%, transparent);
}

.btn.danger {
  color: #ffe4e6;
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.28);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--control-bg);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--control-hover-bg);
  box-shadow: var(--glow);
}

.notification-dot,
.notification-count {
  position: absolute;
  top: 7px;
  right: 7px;
}

.notification-count {
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 50%;
  color: white;
  background: var(--rose);
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.72);
  font-size: 10px;
  font-weight: 900;
}

.notification-dot {
  width: 8px;
  height: 8px;
}

.notification-wrap {
  position: relative;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: min(360px, calc(100vw - 28px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-head span,
.notification-main small {
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item.unread {
  background: var(--subtle-accent);
}

.notification-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.notification-main strong {
  color: var(--text);
  font-size: 13px;
}

.notification-main span,
.notification-empty {
  color: var(--muted);
  font-size: 12px;
}

.notification-empty {
  padding: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--muted) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 18%, transparent);
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.cyan { color: var(--cyan); background: rgba(6, 182, 212, 0.11); border-color: rgba(6, 182, 212, 0.22); }
.badge.teal { color: var(--teal); background: rgba(20, 184, 166, 0.11); border-color: rgba(20, 184, 166, 0.22); }
.badge.green { color: var(--green); background: rgba(34, 197, 94, 0.11); border-color: rgba(34, 197, 94, 0.22); }
.badge.amber { color: var(--amber); background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.24); }
.badge.rose { color: var(--rose); background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.24); }
.badge.red { color: var(--red); background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.24); }
.badge.purple { color: var(--purple); background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.25); }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: white;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--teal) 22%, transparent);
  flex: 0 0 auto;
  overflow: hidden;
}

.avatar.large {
  width: 76px;
  height: 76px;
  font-size: 22px;
  border-radius: 22px;
}

.avatar.role-admin {
  background: linear-gradient(135deg, var(--cyan), var(--amber));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--cyan) 26%, transparent);
}

.avatar.role-doctor {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--teal) 22%, transparent);
}

.avatar.role-receptionist {
  background: linear-gradient(135deg, var(--purple), var(--rose));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--purple) 24%, transparent);
}

.avatar.with-photo,
.avatar.photo-preview {
  background: var(--control-bg);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-control {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-tint);
}

.photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.photo-control input[type="file"] {
  min-height: auto;
  padding: 10px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--page-bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 16px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: 14px 0 44px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(20px);
  overflow-y: auto;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--blue));
}

.sidebar .ct-logo {
  padding: 0 8px 12px;
}

.sidebar .ct-logo-image {
  width: 172px;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-label {
  padding: 8px 10px 4px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--subtle-accent);
}

.nav-link:hover {
  transform: translateX(2px);
}

.nav-link.active {
  color: var(--cyan);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  width: 3px;
  height: 24px;
  border-radius: 0 99px 99px 0;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.85);
}

.nav-link svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.sidebar-user strong,
.topbar-user strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user span,
.topbar-user span {
  display: block;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.main {
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px);
}

.mobile-menu {
  display: none;
}

.global-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.global-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--faint);
}

.global-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px 0 42px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

.global-search input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(6, 182, 212, 0.58);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.11);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--control-bg);
}

.content {
  width: min(100%, 1480px);
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--panel-tint));
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.page-title {
  margin: 0;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.1;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 720px;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pulse-line {
  height: 2px;
  margin: 0 0 24px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--amber), var(--blue), transparent);
  opacity: 0.72;
  overflow: hidden;
  position: relative;
}

.pulse-line::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -30%;
  width: 30%;
  background: linear-gradient(90deg, transparent, white, transparent);
  opacity: 0.28;
  animation: pulse-slide 3.8s ease-in-out infinite;
}

@keyframes pulse-slide {
  to { left: 110%; }
}

.grid {
  display: grid;
  gap: 18px;
}

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

.grid.two {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
}

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

.grid + .panel,
.panel + .panel {
  margin-top: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  min-width: 0;
  overflow: hidden;
  transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.panel.pad {
  padding: 22px;
}

.panel-link {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent, var(--cyan)), transparent);
}

.stat-card.cyan { --accent: var(--cyan); }
.stat-card.teal { --accent: var(--teal); }
.stat-card.blue { --accent: var(--blue); }
.stat-card.rose { --accent: var(--rose); }
.stat-card.amber { --accent: var(--amber); }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--accent, var(--cyan));
  background: color-mix(in srgb, var(--accent, var(--cyan)) 12%, transparent);
}

.stat-value {
  margin: 16px 0 8px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0;
}

.stat-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar .search-field {
  flex: 1 1 320px;
}

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

.field label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  outline: none;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.field textarea {
  min-height: 110px;
  padding-top: 12px;
  resize: vertical;
}

.field input[readonly] {
  color: var(--text-soft);
  background: color-mix(in srgb, var(--muted) 13%, transparent);
  cursor: default;
}

.field small {
  color: var(--faint);
  font-size: 12px;
}

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

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

.form-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.form-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.form-section h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--overlay-bg);
  backdrop-filter: blur(14px);
}

.modal-window {
  width: min(760px, 100%);
  max-height: min(86vh, 840px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--modal-header-bg);
}

.modal-window form {
  padding: 22px 24px 24px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--faint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

td {
  color: var(--text-soft);
  font-size: 14px;
}

.table-note {
  display: block;
  min-width: 180px;
  max-width: 360px;
  white-space: normal;
  line-height: 1.45;
}

.table-select {
  min-width: 132px;
  min-height: 34px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
}

.table-select:focus {
  border-color: rgba(103, 232, 249, 0.55);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.table-select:disabled {
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.72;
}

tr:hover td {
  background: var(--row-hover);
  color: var(--text);
}

.entity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.entity strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.entity span {
  display: block;
  color: var(--faint);
  font-size: 12px;
}

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

.react-admin svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 14px;
  color: var(--text-soft);
  background: var(--page-bg);
  font-weight: 800;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.check-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--panel-tint);
  font-size: 13px;
  font-weight: 700;
}

.check-card input {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.tab {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--control-bg);
  font-size: 13px;
  font-weight: 800;
}

.tab.active {
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.32);
  background: rgba(6, 182, 212, 0.11);
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.profile-main h2 {
  margin: 0;
  font-size: 24px;
}

.profile-main p {
  margin: 5px 0 0;
  color: var(--muted);
}

.info-list {
  display: grid;
  gap: 12px;
}

.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-row span {
  color: var(--muted);
  font-size: 13px;
}

.info-row strong {
  color: var(--text-soft);
  text-align: right;
}

.timeline {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: start;
}

.timeline-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
}

.timeline-item strong {
  display: block;
  color: var(--text);
}

.timeline-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.timeline-time {
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding: 18px;
}

.schedule-day {
  min-height: 170px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-tint);
}

.schedule-day h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-soft);
}

.schedule-slot {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 9px;
  border-radius: var(--radius);
  color: var(--text-soft);
  background: color-mix(in srgb, var(--cyan) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 20%, transparent);
  font-size: 12px;
}

.report-sheet {
  color: #0f172a;
  background: #ffffff;
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.report-sheet h1,
.report-sheet h2,
.report-sheet h3,
.report-sheet p {
  color: inherit;
}

.report-sheet table th,
.report-sheet table td {
  color: #0f172a;
  border-color: #dbe4ef;
}

.report-sheet .badge {
  color: #0f766e;
  background: #ecfeff;
  border-color: #a5f3fc;
}

.notice {
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  border-radius: var(--radius);
  background: var(--subtle-accent);
  color: var(--text-soft);
  font-size: 13px;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: 360px;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--toast-bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loading-card {
  width: min(420px, 100%);
  padding: 28px;
  text-align: center;
  border: 1px solid var(--border);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--teal) 8%, transparent), transparent 42%),
    var(--surface-2);
  box-shadow: var(--shadow), var(--glow);
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.18);
  border-top-color: var(--teal);
  border-right-color: var(--amber);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.public-nav {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}

.public-nav > .btn {
  margin-left: auto;
}

.public-hero {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 44px;
  padding: 24px 0 80px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.7;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-dashboard {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--glow);
  overflow: hidden;
}

.hero-dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.hero-dashboard-body {
  padding: 18px;
}

.hero-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.feature-card {
  min-height: 120px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-tint);
}

.feature-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.public-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 34px;
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: 28px;
  padding: 28px;
  background: var(--page-bg);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: calc(100vh - 56px);
  padding: 44px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 26%, transparent), transparent 42%),
    linear-gradient(225deg, color-mix(in srgb, var(--amber) 18%, transparent), transparent 38%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.auth-brand::after {
  content: "";
  position: absolute;
  left: 44px;
  right: 44px;
  bottom: 92px;
  height: 1px;
  background: linear-gradient(90deg, var(--teal), transparent 70%);
  opacity: 0.7;
}

.auth-brand-main {
  margin: auto 0;
  max-width: 720px;
  position: relative;
  z-index: 1;
}

.auth-brand-main h1 {
  margin: 28px 0 0;
  max-width: 760px;
  font-size: clamp(48px, 7vw, 92px);
  line-height: 0.92;
}

.auth-brand-main p {
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.7;
}

.auth-card-wrap {
  display: grid;
  place-items: center;
  padding: 0;
}

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--teal) 8%, transparent), transparent 34%),
    var(--surface-2);
  box-shadow: var(--shadow), var(--glow);
}

.auth-card .theme-toggle {
  margin-left: auto;
}

.auth-card h2 {
  margin: 22px 0 6px;
  font-size: 30px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.auth-options label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-error {
  display: none;
  padding: 11px 12px;
  border-radius: 10px;
  color: #fecdd3;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.22);
  font-size: 13px;
}

.auth-error.show {
  display: block;
}

.security-note {
  margin-top: 18px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

@media print {
  body {
    background: white !important;
    color: #0f172a !important;
  }

  .sidebar,
  .topbar,
  .page-head,
  .pulse-line,
  .no-print {
    display: none !important;
  }

  .main {
    margin: 0 !important;
    width: 100% !important;
  }

  .content {
    padding: 0 !important;
    width: 100% !important;
  }

  .report-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 232px;
  }

  .sidebar {
    padding-inline: 12px;
  }

  .nav-link {
    font-size: 13px;
  }

  .topbar {
    padding-inline: 20px;
  }

  .content {
    padding: 24px;
  }

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

  .grid.two,
  .public-hero,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 460px;
  }
}

@media (max-width: 1100px) {
  .responsive-table {
    min-width: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }

  .responsive-table tr:last-child {
    border-bottom: 0;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(108px, 34%) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 0;
    white-space: normal;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--faint);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: 280px;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    padding: 13px 16px;
  }

  .topbar-user div:not(.avatar) {
    display: none;
  }

  .content {
    padding: 22px 16px;
  }

  .page-head,
  .profile-header {
    flex-direction: column;
    align-items: stretch;
  }

  .head-actions,
  .form-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .form-grid,
  .grid.stats,
  .grid.three,
  .hero-feature-grid {
    grid-template-columns: 1fr;
  }

  .public-nav {
    width: min(100% - 28px, 1180px);
  }

  .public-hero {
    width: min(100% - 28px, 1180px);
    min-height: auto;
    padding-top: 28px;
  }

  .auth-brand,
  .auth-card-wrap {
    padding: 26px 16px;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 10px;
  }

  .global-search {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  .page-title {
    font-size: 26px;
  }

  .responsive-table td {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

/* ── Skeleton loading ────────────────────────────────────────────────── */

.skeleton-preview {
  width: 100%;
  max-width: 420px;
  margin: 18px auto 0;
  display: grid;
  gap: 12px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.skeleton-bar {
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.1) 25%,
    rgba(148, 163, 184, 0.2) 50%,
    rgba(148, 163, 184, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-bar.wide {
  height: 22px;
}

.skeleton-bar.card {
  height: 64px;
}

.skeleton-bar.table {
  height: 100px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Clinical checks fieldset ────────────────────────────────────────── */

.clinical-checks-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0;
  background: var(--panel-tint);
}

.clinical-checks-fieldset legend {
  padding: 0 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-soft);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 18px;
  margin-top: 10px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
}

.checkbox-grid input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  cursor: pointer;
}
