:root {
  --background: hsl(210 20% 99%);
  --foreground: hsl(215 25% 15%);
  --card: #fff;
  --muted: hsl(214 15% 96%);
  --muted-foreground: hsl(215 16% 47%);
  --border: hsl(214 20% 92%);
  --primary: hsl(194 89% 39%);
  --primary-foreground: #fff;
  --secondary: hsl(224 44% 42%);
  --accent: hsl(194 60% 95%);
  --accent-foreground: hsl(194 89% 30%);
  --success: hsl(142 71% 45%);
  --warning: hsl(38 92% 50%);
  --destructive: hsl(0 84% 60%);
  --radius: 16px;
  --font-heading: "Sora", sans-serif;
  --font-body: "Manrope", sans-serif;
  --shadow-soft: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow-card: 0 4px 16px -2px rgb(0 0 0 / 0.06), 0 1px 3px -1px rgb(0 0 0 / 0.04);
  --shadow-elevated: 0 10px 30px -8px rgb(0 0 0 / 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

img, video, iframe {
  max-width: 100%;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.muted {
  color: var(--muted-foreground);
}

.hidden {
  display: none !important;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.public-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: blur(12px);
}

.nav-inner, .patient-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

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

.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, hsl(194 89% 39% / 0.06), transparent 45%, hsl(194 60% 95% / 0.95));
}

.hero-inner {
  position: relative;
  padding: 96px 0 104px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--primary);
  background: hsl(194 89% 39% / 0.10);
  font-size: 14px;
  font-weight: 600;
}

.hero h1 {
  max-width: 760px;
  margin-inline: auto;
  font-size: 56px;
  letter-spacing: 0;
}

.hero h1 span {
  color: var(--primary);
}

.hero p {
  max-width: 660px;
  margin: 24px auto 0;
  color: var(--muted-foreground);
  font-size: 20px;
}

.section {
  padding: 72px 0;
}

.section-heading {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section-heading h2 {
  font-size: 34px;
}

.section-heading p {
  margin-top: 12px;
  color: var(--muted-foreground);
  font-size: 18px;
}

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

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

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

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

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

.card.hover {
  transition: transform .25s ease, box-shadow .25s ease;
}

.card.hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-elevated);
}

.card-header {
  padding: 20px 20px 10px;
}

.card-content {
  padding: 20px;
}

.feature-icon, .stat-icon, .avatar, .status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feature-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 14px;
  color: var(--primary);
  background: hsl(194 89% 39% / 0.10);
}

.cta-band {
  padding: 64px 0;
  color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  text-align: center;
}

.cta-band p {
  max-width: 600px;
  margin: 14px auto 28px;
  color: rgb(255 255 255 / .82);
  font-size: 18px;
}

.public-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted-foreground);
  font-size: 14px;
}

.footer-inner img {
  height: 28px;
  opacity: .6;
}

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-foreground);
  font: 600 14px var(--font-body);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

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

.btn-secondary {
  background: #fff;
  color: var(--primary);
}

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

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

.btn-danger {
  background: var(--destructive);
  color: #fff;
}

.btn-sm {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.pill {
  border-radius: 999px;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.notification-btn span {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--destructive);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.form-card {
  width: min(390px, calc(100% - 32px));
  margin: 0 auto;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--background), var(--background), hsl(194 60% 95% / .7));
}

.login-logo {
  display: block;
  height: 64px;
  margin: 0 auto 12px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label, .label {
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
  background: #fff;
  color: var(--foreground);
  font: 400 14px var(--font-body);
}

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

input:focus, select:focus, textarea:focus, .rte-editor:focus {
  outline: 2px solid hsl(194 89% 39% / .18);
  border-color: var(--primary);
}

.input-pill {
  border-radius: 999px;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  width: 270px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #fff;
  transition: transform .2s ease;
}

.sidebar-logo {
  border-bottom: 1px solid var(--border);
  padding: 20px 18px;
}

.sidebar-logo img {
  height: 36px;
}

.sidebar-section {
  padding: 12px 10px;
}

.sidebar-section p {
  padding: 0 12px 6px;
  color: rgb(95 109 128 / .75);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  color: hsl(215 25% 27%);
  font-weight: 600;
}

.sidebar-link:hover, .sidebar-link.active {
  background: var(--accent);
  color: var(--accent-foreground);
}

.sidebar-link.danger {
  color: var(--destructive);
}

.sidebar-link.danger:hover {
  background: hsl(0 84% 60% / .10);
}

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

.admin-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-topbar, .patient-header {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / .84);
  backdrop-filter: blur(12px);
}

.admin-topbar {
  padding: 0 18px;
}

.topbar-spacer {
  flex: 1;
}

.admin-content {
  padding: 26px;
}

.patient-header-inner {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
}

.patient-page {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--background), hsl(194 60% 95% / .35));
}

.patient-main {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

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

.stat-card .card-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}

.stat-card h3 {
  color: var(--muted-foreground);
  font: 600 14px var(--font-body);
}

.stat-value {
  font: 700 32px var(--font-heading);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--primary);
  background: hsl(194 89% 39% / .10);
}

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

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.search-wrap .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted-foreground);
}

.search-wrap input {
  padding-left: 38px;
  border-radius: 999px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 800;
}

.table tr.row-link {
  cursor: pointer;
}

.table tr.row-link:hover {
  background: hsl(194 60% 95% / .55);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--primary);
  background: hsl(194 89% 39% / .10);
  font-weight: 800;
}

.cell-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-secondary {
  background: var(--muted);
  color: var(--muted-foreground);
}

.badge-outline {
  border-color: var(--border);
  background: #fff;
  color: var(--foreground);
}

.badge-danger {
  background: hsl(0 84% 60% / .11);
  color: var(--destructive);
  border-color: hsl(0 84% 60% / .20);
}

.badge-warning {
  background: hsl(38 92% 50% / .12);
  color: hsl(34 92% 42%);
  border-color: hsl(38 92% 50% / .2);
}

.badge-success {
  background: hsl(142 71% 45% / .12);
  color: var(--success);
  border-color: hsl(142 71% 45% / .2);
}

.badge-primary {
  background: var(--primary);
  color: #fff;
}

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--muted);
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: var(--primary);
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 999px;
  background: var(--muted);
  width: fit-content;
}

.tab-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 9px 14px;
  font-weight: 800;
  color: var(--muted-foreground);
  cursor: pointer;
}

.tab-btn.active {
  background: #fff;
  color: var(--foreground);
  box-shadow: var(--shadow-soft);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.exercise-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.exercise-row + .exercise-row {
  margin-top: 10px;
}

.exercise-row.completed {
  border-color: hsl(142 71% 45% / .18);
  background: hsl(142 71% 45% / .055);
}

.exercise-row.locked {
  opacity: .55;
  background: var(--muted);
}

.status-dot {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--primary);
  background: hsl(194 89% 39% / .10);
}

.status-dot.success {
  color: var(--success);
  background: hsl(142 71% 45% / .10);
}

.status-dot.muted {
  color: var(--muted-foreground);
  background: var(--muted);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgb(15 23 42 / .44);
}

.dialog-backdrop.open {
  display: flex;
}

.dialog {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-elevated);
}

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

.dialog-body {
  padding: 16px 20px 20px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.close-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.rte {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.rte-toolbar {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  padding: 5px;
}

.rte-toolbar button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.rte-toolbar button:hover {
  background: var(--accent);
}

.rte-editor {
  min-height: 90px;
  padding: 10px 12px;
}

.check-list {
  display: grid;
  gap: 7px;
  max-height: 190px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.check-item:hover, .check-item:has(input:checked) {
  background: var(--accent);
}

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

.ordered-item {
  display: grid;
  grid-template-columns: 28px 1fr 76px auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--muted);
}

.circle-progress {
  --value: 0;
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--primary) calc(var(--value) * 1%), var(--muted) 0);
  font: 700 18px var(--font-heading);
}

.circle-progress::before {
  content: "";
  position: absolute;
}

.notification-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.notification-card.unread {
  border-color: hsl(194 89% 39% / .22);
  background: hsl(194 89% 39% / .025);
}

.notification-card.read {
  opacity: .65;
}

.prose p + p, .prose ul, .prose ol {
  margin-top: 8px;
}

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

.toast-root {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-elevated);
  font-weight: 700;
  animation: fade-in .25s ease both;
}

.toast-success {
  color: var(--success);
}

.toast-error {
  color: var(--destructive);
}

.toast-info {
  color: var(--primary);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fade-in .35s ease both;
}

@media (max-width: 980px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-sidebar {
    position: fixed;
    z-index: 35;
    transform: translateX(-100%);
  }

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

@media (max-width: 720px) {
  .hero-inner {
    padding: 64px 0 72px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero p {
    font-size: 17px;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .admin-content {
    padding: 18px;
  }

  .hide-mobile {
    display: none;
  }

  .ordered-item {
    grid-template-columns: 28px 1fr;
  }

  .ordered-item input, .ordered-item .item-actions {
    grid-column: 2;
  }
}

