:root {
  --blue: #0D3B73;
  --light-green: #C2E27C;
  --yellow: #FFD659;
  --light-blue: #6DAFE5;
  --coral: #FF7E7E;
  --white: #ffffff;
  --dark-overlay: rgba(0,0,0,0.5);
  --avatar-placeholder: #CCCCCC;
  --avatar-color-1: #FFD659;
  --avatar-color-2: #C2E27C;
  --avatar-color-3: #6DAFE5;
  --avatar-color-4: #FF7E7E;
  --avatar-color-5: #F8A5C2;
  --fs-base: 1.18rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

body {
  display: flex;
  flex-direction: column;
  font-family: Poppins, sans-serif;
  background-color: var(--blue);
  color: var(--white);
  position: relative;
}

body.auth-page {
  min-height: 100vh;
  overflow-y: auto;
}

body.app-page {
  overflow: hidden;
}

#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

#bg-tek {
  position: absolute;
  bottom: 100px;
  right: 100px;
  transform: translate(50%, 50%) rotate(-45deg);
  opacity: 0.05;
  z-index: 0;
  pointer-events: none;
  max-width: 50vmin;
}

.site-logo-top {
  display: block;
  width: min(260px, 62vw);
  margin: 0 auto 1.25rem;
}

.btn-eltern {
  background: var(--white);
  color: var(--blue);
  border: none;
  border-radius: 1.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.btn {
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 50px;
  padding: 0.75rem 2rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.page-footer-links {
  margin-top: 1.1rem;
  font-size: 0.78rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
}

.page-footer-links a {
  color: inherit;
  text-decoration: none;
  margin: 0 0.3rem;
}

.page-footer-links a:hover {
  text-decoration: underline;
}

/* ===== Login / Auth ===== */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 2rem;
  backdrop-filter: blur(8px);
}

.auth-card.auth-card-wide {
  max-width: 460px;
}

.auth-card h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-card p {
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.auth-card label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.auth-card input {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font: inherit;
}

.auth-card button,
.auth-card .link-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1rem;
  font: inherit;
  font-weight: 600;
  background: var(--yellow);
  color: var(--blue);
  cursor: pointer;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.auth-error,
.auth-success,
.auth-username-box {
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.auth-error {
  background: rgba(214, 69, 69, 0.15);
  border: 1px solid rgba(214, 69, 69, 0.45);
  color: #fff;
}

.auth-success {
  background: rgba(47, 158, 68, 0.18);
  border: 1px solid rgba(47, 158, 68, 0.45);
}

.auth-username-box {
  background: rgba(255,255,255,0.12);
}

.auth-hint {
  margin-top: 1rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.session-hint {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  opacity: 0.72;
}

.auth-small {
  font-size: 0.92rem;
  opacity: 0.85;
}

/* ===== App ===== */

header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  z-index: 1;
}

.header-tab-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  font-size: 3rem;
  font-weight: 500;
  pointer-events: none;
}

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.profile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.profile-btn .avatar-emoji {
  width: 85px;
  height: 85px;
  border-radius: 15px;
  background: var(--avatar-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.profile-btn span {
  background: var(--white);
  color: var(--blue);
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  margin-top: -8px;
}

.dashboard {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  z-index: 1;
}

.card {
  flex: 1 1 0;
  aspect-ratio: 1 / 1;
  max-width: 200px;
  border-radius: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px var(--dark-overlay);
}

.card .icon {
  max-width: 45%;
  max-height: 45%;
}

.card-label {
  display: block;
  margin-top: 0.5rem;
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  text-transform: capitalize;
  text-align: center;
}

.card[data-tab="sound"] { background: var(--light-green); }
.card[data-tab="emotion"] { background: var(--yellow); }
.card[data-tab="reading"] { background: var(--light-blue); }
.card[data-tab="favorites"] { background: var(--coral); }

.tabs {
  display: none;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
}

.tab-nav {
  display: flex;
  justify-content: center;
  gap: 3.5rem;
  background: transparent;
  padding: 0.5rem;
  position: relative;
  z-index: 0;
}

.tab-nav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  background: rgba(13, 66, 136, 0.8);
  z-index: -2;
}

.tab-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(79, 153, 255, 0.8);
  z-index: 2;
}

.tab-nav .tab-btn {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.tab-nav .tab-btn[data-tab="sound"] { background: var(--light-green); }
.tab-nav .tab-btn[data-tab="emotion"] { background: var(--yellow); }
.tab-nav .tab-btn[data-tab="reading"] { background: var(--light-blue); }
.tab-nav .tab-btn[data-tab="favorites"] { background: var(--coral); }

.tab-nav .tab-btn.active {
  position: relative;
  z-index: 2;
}

.tab-nav .tab-btn.active::before {
  content: "";
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -7px;
  background: rgba(7, 41, 86, 0.8);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  z-index: 0;
}

.tab-nav .icon {
  max-width: 45%;
  max-height: 45%;
  z-index: 2;
}

.tab-content {
  flex: 1;
  display: none;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 1rem;
  justify-content: center;
  align-content: center;
  position: relative;
  background: rgba(7, 41, 86, 0.8);
  z-index: -3;
}

.tab-content.active {
  display: flex;
}

.tab-content::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(79, 153, 255, 0.8);
  z-index: -1;
}

.subcard {
  flex: 1 1 0;
  aspect-ratio: 1 / 1;
  max-width: 200px;
  border-radius: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.subcard .card-label {
  margin-top: 0.5rem;
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

.done-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(47, 158, 68, 0.95);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.is-completed {
  opacity: 0.72;
}

.is-completed .done-check {
  display: flex;
}

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-overlay);
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal {
  background: var(--white);
  color: var(--blue);
  padding: 1rem;
  border-radius: 16px;
  width: 360px;
  max-height: calc(100vh - 3rem);
  overflow: auto;
  position: relative;
}

.modal h2 {
  margin-bottom: 0.75rem;
}

.modal label {
  display: block;
  margin: 0.5rem 0 0.2rem;
}

.modal input {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.modal .btn {
  width: 100%;
  margin-top: 1rem;
}

.close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--blue);
}

.emoji-options {
  display: flex;
  gap: 0.5rem;
  font-size: 1.5rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.emoji-options span {
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 0.5rem;
  background: var(--avatar-placeholder);
}

.emoji-options span.selected {
  background: var(--blue);
}

.color-options {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.color-options .color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.color-options .selected {
  border: 3px solid var(--white);
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.profile-sfx-toggle-row {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(13,59,115,0.06);
}

.profile-sfx-toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(13,59,115,0.84);
}

.profile-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.profile-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.profile-switch-slider {
  position: absolute;
  inset: 0;
  background: rgba(13,59,115,0.28);
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.profile-switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}

.profile-switch input:checked + .profile-switch-slider {
  background: #2f9e44;
}

.profile-switch input:checked + .profile-switch-slider::before {
  transform: translateX(18px);
}

.profile-switch input:focus-visible + .profile-switch-slider {
  box-shadow: 0 0 0 3px rgba(109,175,229,0.45);
}

.profile-meta-support {
  margin: -0.1rem 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(13,59,115,0.05);
  color: rgba(13,59,115,0.62);
  font-size: 0.78rem;
  line-height: 1.4;
}

.profile-meta-support strong {
  color: rgba(13,59,115,0.72);
  font-weight: 600;
}

.profile-collapsible-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(13,59,115,0.15);
}

.profile-collapsible-toggle {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0;
  color: #0D3B73;
  cursor: pointer;
  text-align: left;
}

.profile-collapsible-title {
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.2;
}

.profile-collapsible-meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.profile-collapsible-kpi {
  border-radius: 999px;
  border: 1px solid #f59e0b;
  background: color-mix(in srgb, #f59e0b 22%, #ffffff 78%);
  padding: 0.2rem 0.52rem;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  color: #0D3B73;
}

.profile-collapsible-kpi-value {
  font-size: 1rem;
  font-weight: 700;
  color: #0D3B73;
}

.profile-collapsible-icon {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid rgba(13,59,115,0.72);
  border-bottom: 2px solid rgba(13,59,115,0.72);
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 0.2s ease;
  margin-right: 0.2rem;
}

.profile-collapsible-section.is-expanded .profile-collapsible-icon {
  transform: rotate(225deg);
  margin-top: 0.2rem;
}

.profile-collapsible-body {
  margin-top: 0.65rem;
}

.profile-collapsible-body-center {
  text-align: center;
}

.profile-status-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.profile-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: rgba(13,59,115,0.06);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.profile-status-label {
  font-size: 0.92rem;
  font-weight: 500;
}

.profile-status-badge {
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(13,59,115,0.12);
  white-space: nowrap;
}

.profile-status-badge.completed {
  background: rgba(47, 158, 68, 0.18);
  color: #1e7a31;
}

.profile-status-badge.in-progress {
  background: rgba(255, 214, 89, 0.35);
  color: #7a5a00;
}

.profile-status-badge.not-started {
  background: rgba(13,59,115,0.12);
  color: #0D3B73;
}

.qr-box {
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem;
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0.75rem;
}

#profileQrCode {
  width: 100%;
  height: auto;
  min-width: 220px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

#profileQrCode canvas,
#profileQrCode img {
  display: block;
}

.qr-url {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.3;
  word-break: break-all;
  color: rgba(13,59,115,0.7);
}

.session-hint-modal {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
  color: rgba(13,59,115,0.65);
}

.save-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.2rem;
  text-align: center;
}

.save-status.error {
  color: #c92a2a;
}

.save-status.success {
  color: #1e7a31;
}

footer#footer {
  position: relative;
  height: 60px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  pointer-events: none;
}

.footer-logo {
  width: 150px;
  opacity: 0.3;
  pointer-events: auto;
  cursor: pointer;
}

.footer-home {
  width: 40px;
  opacity: 0.5;
  pointer-events: auto;
  cursor: pointer;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.footer-links {
  position: absolute;
  bottom: 0.25rem;
  right: 0.5rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.8);
  opacity: 0.5;
  pointer-events: auto;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
  margin: 0 0.25rem;
}

.modal-frame {
  position: fixed;
  inset: 1rem;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  padding: 0;
  z-index: 9999;
}

.modal-frame iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

#subcardModal {
  background: transparent;
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99;
}

#subcardModal .close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #ff0000b9;
  cursor: pointer;
  z-index: 1000;
}

#btnFullscreen {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  left: auto;
  background: rgba(13,59,115,0.42);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  font-size: 1.1rem;
  color: #ffffff;
  cursor: pointer;
  z-index: 10050;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(3px);
}

#btnFullscreen:hover {
  opacity: 0.95;
  background: rgba(13,59,115,0.62);
}
.forms-modal {
  width: min(880px, 95vw);
  max-height: calc(100vh - 3rem);
}

.forms-modal-question {
  margin: 0.5rem 0 0.9rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.forms-modal-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}

.forms-option-btn {
  border: 1px solid rgba(13, 59, 115, 0.24);
  background: #ffffff;
  color: #0D3B73;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  min-width: 70px;
}

.forms-option-btn.is-selected {
  border-color: #0D3B73;
  box-shadow: inset 0 0 0 2px rgba(13, 59, 115, 0.25);
  background: rgba(13, 59, 115, 0.08);
}

.forms-option-image {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.forms-option-caption {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  display: block;
}

.forms-modal-help {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(13, 59, 115, 0.7);
}

.forms-modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

.forms-modal-actions .btn {
  width: auto;
  min-width: 120px;
  margin-top: 0;
}

.pdf-viewer-frame {
  background: #ffffff;
}


#pdfViewerFrame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* ===== Patient View Fix Overrides ===== */
header {
  min-height: 110px;
}

header .parent-area {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 56px;
  left: auto;
  z-index: 12000;
  display: flex;
  align-items: center;
}
header .profile {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 3;
}

/* Progress ring with tile color + doneface icon */
.done-check {
  display: flex;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #0D3B73;
  background: rgba(255,255,255,0.55);
  border: 2px solid rgba(255,255,255,0.92);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.done-check::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.94);
}

.done-check::after {
  content: "";
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0;
}

.done-face-img {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 2;
  width: 17px;
  height: 17px;
  object-fit: contain;
  display: none;
  transform: none;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.4));
}

.is-completed .done-face-img {
  display: block;
}

.is-completed,
.is-in-progress,
.is-paused,
.is-aborted {
  opacity: 0.9;
}

.is-completed .done-check,
.is-in-progress .done-check,
.is-paused .done-check,
.is-aborted .done-check {
  display: flex;
}

.is-completed .done-check {
  --tile-progress: 100;
  background: conic-gradient(var(--tile-ring-color, #2f9e44) 100%, rgba(255,255,255,0.35) 0);
}

.is-completed .done-check::before {
  background: #2F9E44;
}

.is-completed .done-check::after {
  content: none;
  opacity: 0;
  background-image: none;
  width: 0;
  height: 0;
}

.is-in-progress .done-check {
  background: conic-gradient(var(--tile-ring-color, #2f9e44) calc(var(--tile-progress, 0) * 1%), rgba(255,255,255,0.3) 0);
}

.is-paused .done-check {
  background: conic-gradient(#E4B74A calc(var(--tile-progress, 0) * 1%), rgba(255,255,255,0.3) 0);
}

.is-paused .done-check::after {
  content: "||";
  width: auto;
  height: auto;
  opacity: 1;
  letter-spacing: 1px;
  color: #7a5a00;
  font-weight: 700;
}

.is-aborted .done-check {
  background: rgba(214, 69, 69, 0.92);
}

.is-aborted .done-check::after {
  content: "!";
  width: auto;
  height: auto;
  opacity: 1;
  color: #b02a2a;
  font-weight: 700;
}

/* Profile progress/achievement */
.profile-progress-kpis {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.profile-progress-kpi {
  background: rgba(13,59,115,0.08);
  border: 1px solid rgba(13,59,115,0.14);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
}

.profile-progress-kpi-label {
  font-size: 0.72rem;
  color: rgba(13,59,115,0.62);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-progress-kpi-value {
  margin-top: 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #0D3B73;
}

.profile-progress-kpi.is-done {
  border-color: color-mix(in srgb, var(--kpi-done-color, #2F9E44) 45%, #ffffff 55%);
  background: color-mix(in srgb, var(--kpi-done-color, #2F9E44) 18%, #ffffff 82%);
}

.profile-progress-kpi.is-done .profile-progress-kpi-label,
.profile-progress-kpi.is-done .profile-progress-kpi-value {
  color: color-mix(in srgb, var(--kpi-done-color, #2F9E44) 78%, #10355f 22%);
}

.profile-achievement-list {
  margin-top: 0;
}

.profile-achievement-title {
  margin: 0 0 0.45rem 0;
  font-size: 0.9rem;
  color: #0D3B73;
}

.profile-achievement-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.profile-achievement-item {
  border-radius: 10px;
  border: 1px solid rgba(13,59,115,0.22);
  padding: 0.5rem 0.65rem;
  background: rgba(13,59,115,0.06);
}

.profile-achievement-item.is-locked {
  opacity: 0.62;
}

.profile-achievement-item.is-unlocked {
  border-color: rgba(47, 158, 68, 0.45);
  background: rgba(47, 158, 68, 0.12);
}

.profile-achievement-name {
  font-weight: 700;
  color: #0D3B73;
  font-size: 0.86rem;
}

.profile-achievement-desc {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: rgba(13,59,115,0.82);
}

.profile-achievement-state {
  margin-top: 0.3rem;
  display: inline-flex;
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  font-size: 0.72rem;
  background: rgba(13,59,115,0.14);
  color: #0D3B73;
}

.profile-achievement-item.is-unlocked .profile-achievement-state {
  background: rgba(47, 158, 68, 0.24);
  color: #1f7a31;
}

.achievement-modal {
  width: min(560px, 94vw);
  max-height: min(86vh, 820px);
}

.achievement-modal .btn {
  width: auto;
  min-width: 120px;
  margin: 1rem auto 0;
  display: inline-flex;
  justify-content: center;
}

.achievement-scratch-shell {
  margin-top: 0.85rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(13,59,115,0.18);
  position: relative;
  background: #0E2A4E;
  width: 100%;
  height: min(52vh, 360px);
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.achievement-scratch-color,
.achievement-scratch-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.achievement-scratch-color {
  object-fit: contain;
  object-position: center;
}

.achievement-scratch-canvas {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: crosshair;
}

.achievement-scratch-hint {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #fff;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(2px);
}

@media (max-width: 760px) {
  .profile-progress-kpis {
    grid-template-columns: 1fr;
  }

  .profile-status-head {
    flex-direction: column;
    align-items: flex-start;
  }
}


.profile-progress-summary {
  margin-top: 0.55rem;
  margin-bottom: 0.6rem;
  border-radius: 12px;
  border: 1px solid #f59e0b;
  background: color-mix(in srgb, #f59e0b 22%, #ffffff 78%);
  padding: 0.5rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-progress-summary-label {
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(13,59,115,0.75);
}

.profile-progress-summary-value {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0D3B73;
}




/* ===== Login Page Overrides (Patient Login) ===== */
body.auth-page.login-page {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.auth-page.login-page .auth-shell {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(0.55rem, 1.5vh, 1rem) 1rem 3.75rem;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.auth-page.login-page .auth-shell::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body.auth-page.login-page .auth-card {
  width: min(100%, 420px);
  max-height: none;
  overflow: visible;
}

body.auth-page.login-page footer#footer.auth-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60px;
  min-height: 60px;
  justify-content: center;
  padding-right: 0;
  z-index: 20;
  pointer-events: auto;
}

body.auth-page.login-page footer#footer.auth-footer .footer-home,
body.auth-page.login-page footer#footer.auth-footer .footer-logo {
  display: none;
}

body.auth-page.login-page footer#footer.auth-footer .footer-links {
  position: absolute;
  bottom: 0.25rem;
  right: 0.5rem;
  margin-right: 0;
  opacity: 0.5;
  font-size: 0.7rem;
  pointer-events: auto;
  z-index: 21;
}

body.auth-page.login-page #subcardModal {
  z-index: 10000;
}

@media (max-width: 560px) {
  body.auth-page.login-page .site-logo-top {
    width: min(200px, 58vw);
    margin-bottom: 0.75rem;
  }

  body.auth-page.login-page .auth-card {
    padding: 1.2rem;
    border-radius: 18px;
  }

  body.auth-page.login-page .auth-card h1 {
    font-size: 1.7rem;
    margin-bottom: 0.35rem;
  }

  body.auth-page.login-page .auth-card p {
    margin-bottom: 0.9rem;
    font-size: 0.95rem;
  }

  body.auth-page.login-page .auth-card input {
    padding: 0.78rem 0.9rem;
    margin-bottom: 0.78rem;
  }

  body.auth-page.login-page .auth-card button {
    padding: 0.82rem 0.9rem;
  }

  body.auth-page.login-page .auth-hint {
    margin-top: 0.75rem;
    font-size: 0.82rem;
  }

  body.auth-page.login-page .session-hint {
    margin-top: 0.6rem;
    font-size: 0.76rem;
  }
}

@media (max-height: 760px) {
  body.auth-page.login-page .auth-card {
    padding: 1.2rem;
    border-radius: 18px;
  }

  body.auth-page.login-page .site-logo-top {
    width: min(180px, 50vw);
    margin-bottom: 0.6rem;
  }

  body.auth-page.login-page .auth-card h1 {
    margin-bottom: 0.25rem;
    font-size: 1.75rem;
  }

  body.auth-page.login-page .auth-card p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
  }

  body.auth-page.login-page .auth-card label {
    margin-bottom: 0.25rem;
  }

  body.auth-page.login-page .auth-card input {
    margin-bottom: 0.7rem;
    padding: 0.75rem 0.85rem;
  }

  body.auth-page.login-page .auth-card button {
    padding: 0.78rem 0.85rem;
  }

  body.auth-page.login-page .session-hint {
    margin-top: 0.55rem;
    font-size: 0.74rem;
  }

  body.auth-page.login-page .auth-hint {
    margin-top: 0.65rem;
    font-size: 0.8rem;
  }
}
