*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:DM Sans,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.inline{display:inline}.hidden{display:none}/* ================================================================
   PHYTONODOL® 600 — Portal de Farmacias (VERSIÓN LILA)
   Color principal: #380067 (Phytonodol lila)
   Optimizado para tablet 11" táctil
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── TOKENS LILA ────────────────────────────────────────────────── */
:root {
  /* Marca Phytonodol LILA */
  --purple-900:   #1f0040;
  --purple-800:   #2a0050;
  --purple-700:   #380067;
  --purple-600:   #4a1a7a;
  --purple-500:   #5c2a8d;
  --purple-400:   #7e3aa3;
  --purple-200:   #f8f0ff;
  --purple-100:   #f0e6ff;
  --purple-50:    #faf8ff;

  --gold:        #b5803a;
  --gold-lt:     #f9f0e3;

  --white:       #ffffff;
  --off-white:   #f8faf9;
  --border:      #dde8e1;
  --border-dk:   #c0d4c8;

  --text:        #1a2a22;
  --text-2:      #3d5447;
  --text-3:      #6b8c7a;
  --text-inv:    #ffffff;

  --error:       #b33a2c;
  --error-lt:    #fdf0ee;
  --warning:     #9a6c10;
  --warning-lt:  #fdf7ec;
  --success:     #380067;
  --success-lt:  #f8f0ff;

  /* Layout */
  --max-w:       900px;
  --radius:      16px;
  --radius-sm:   12px;
  --radius-xs:   6px;
  --shadow:      0 2px 16px rgba(56,0,103,.08);
  --shadow-md:   0 6px 28px rgba(56,0,103,.12);
  --shadow-lg:   0 16px 48px rgba(56,0,103,.18);

  /* Tipografía */
  --font-serif:  'DIN Next LT Pro', Georgia, serif;
  --font-sans:   'DIN Next LT Pro', 'DIN Next Rounded LT Pro', system-ui, sans-serif;

  /* Táctil optimizado */
  --tap:         60px;
  --tap-xl:      72px;
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--off-white);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
img { max-width: 100%; }
button { font-family: var(--font-sans); }

/* ── LAYOUT RAÍZ ────────────────────────────────────────────── */
#fpm-root { display: flex; flex-direction: column; min-height: 100vh; }

/* ── HEADER ─────────────────────────────────────────────────── */
#fpm-header {
  background: white;
  color: var(--text);
  height: 80px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(56,0,103,.25);
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logo {
  height: 36px;
  width: auto;
}
.header-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .2px;
  opacity: .95;
}
.header-sub {
  font-size: 13px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
  font-weight: 500;
  opacity: 1;
  margin-top: 1px;
  font-weight: bold;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-right[hidden] {
  display: none !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions.header-hidden {
  display: none !important;
}

.header-farmacia {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 16px;
  min-height: 54px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
}
.header-farmacia-icon { opacity: .7; font-size: 18px; }

/* ── FUENTES DIN NEXT ───────────────────────────────────────────────── */
@font-face {
    font-family: 'DIN Next LT Pro';
    src: url('../fonts/DINNextLTPro-BlackCondensed.eot');
    src: local('DIN Next LT Pro Black Condensed'), local('DINNextLTPro-BlackCondensed'),
        url('../fonts/DINNextLTPro-BlackCondensed.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-BlackCondensed.woff') format('woff'),
        url('../fonts/DINNextLTPro-BlackCondensed.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next LT Pro';
    src: url('../fonts/DINNextLTPro-Regular.eot');
    src: local('DIN Next LT Pro Regular'), local('DINNextLTPro-Regular'),
        url('../fonts/DINNextLTPro-Regular.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-Regular.woff2') format('woff2'),
        url('../fonts/DINNextLTPro-Regular.woff') format('woff'),
        url('../fonts/DINNextLTPro-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next LT Pro';
    src: url('../fonts/DINNextLTPro-Medium.eot');
    src: local('DIN Next LT Pro Medium'), local('DINNextLTPro-Medium'),
        url('../fonts/DINNextLTPro-Medium.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-Medium.woff2') format('woff2'),
        url('../fonts/DINNextLTPro-Medium.woff') format('woff'),
        url('../fonts/DINNextLTPro-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next LT Pro';
    src: url('../fonts/DINNextLTPro-Bold.eot');
    src: local('DIN Next LT Pro Bold'), local('DINNextLTPro-Bold'),
        url('../fonts/DINNextLTPro-Bold.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-Bold.woff2') format('woff2'),
        url('../fonts/DINNextLTPro-Bold.woff') format('woff'),
        url('../fonts/DINNextLTPro-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next LT Pro';
    src: url('../fonts/DINNextLTPro-BoldItalic.eot');
    src: local('DIN Next LT Pro Bold Italic'), local('DINNextLTPro-BoldItalic'),
        url('../fonts/DINNextLTPro-BoldItalic.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-BoldItalic.woff2') format('woff2'),
        url('../fonts/DINNextLTPro-BoldItalic.woff') format('woff'),
        url('../fonts/DINNextLTPro-BoldItalic.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

@font-face {
    font-family: 'DIN Next LT Pro';
    src: url('../fonts/DINNextLTPro-UltraLightCond.eot');
    src: local('DIN Next LT Pro UltraLight Condensed'), local('DINNextLTPro-UltraLightCond'),
        url('../fonts/DINNextLTPro-UltraLightCond.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-UltraLightCond.woff2') format('woff2'),
        url('../fonts/DINNextLTPro-UltraLightCond.woff') format('woff'),
        url('../fonts/DINNextLTPro-UltraLightCond.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next LT Pro Condensed';
    src: url('../fonts/DINNextLTPro-BoldCondensed.eot');
    src: local('DIN Next LT Pro Bold Condensed'), local('DINNextLTPro-BoldCondensed'),
        url('../fonts/DINNextLTPro-BoldCondensed.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextLTPro-BoldCondensed.woff2') format('woff2'),
        url('../fonts/DINNextLTPro-BoldCondensed.woff') format('woff'),
        url('../fonts/DINNextLTPro-BoldCondensed.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next Rounded LT Pro';
    src: url('../fonts/DINNextRoundedLTPro-Light.eot');
    src: local('DIN Next Rounded LT Pro Light'), local('DINNextRoundedLTPro-Light'),
        url('../fonts/DINNextRoundedLTPro-Light.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextRoundedLTPro-Light.woff') format('woff'),
        url('../fonts/DINNextRoundedLTPro-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next Rounded LT Pro';
    src: url('../fonts/DINNextRoundedLTPro-Medium.eot');
    src: local('DIN Next Rounded LT Pro Medium'), local('DINNextRoundedLTPro-Medium'),
        url('../fonts/DINNextRoundedLTPro-Medium.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextRoundedLTPro-Medium.woff') format('woff'),
        url('../fonts/DINNextRoundedLTPro-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next Rounded LT Pro';
    src: url('../fonts/DINNextRoundedLTPro-Regular.eot');
    src: local('DIN Next Rounded LT Pro Regular'), local('DINNextRoundedLTPro-Regular'),
        url('../fonts/DINNextRoundedLTPro-Regular.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextRoundedLTPro-Regular.woff') format('woff'),
        url('../fonts/DINNextRoundedLTPro-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'DIN Next Rounded LT Pro';
    src: url('../fonts/DINNextRoundedLTPro-Bold.eot');
    src: local('DIN Next Rounded LT Pro Bold'), local('DINNextRoundedLTPro-Bold'),
        url('../fonts/DINNextRoundedLTPro-Bold.eot?#iefix') format('embedded-opentype'),
        url('../fonts/DINNextRoundedLTPro-Bold.woff') format('woff'),
        url('../fonts/DINNextRoundedLTPro-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

/* ── MAIN ───────────────────────────────────────────────────── */
#fpm-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── PÁGINAS ────────────────────────────────────────────────── */
.fpm-page[hidden] {
  display: none !important;
}
.fpm-page {
  min-height: calc(100vh - 80px);
}
.fpm-page:not([hidden]) { display: flex; flex-direction: column; }

.page-inner {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: 40px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── BOTONES ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  padding: 0 24px;
  min-height: var(--tap);
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background .15s;
}
.btn:active::after { background: rgba(255,255,255,.15); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
  background: var(--purple-700);
  color: white;
  box-shadow: 0 4px 14px rgba(56,0,103,.3);
}
.btn--primary:hover:not(:disabled) {
  background: var(--purple-800);
  box-shadow: 0 6px 18px rgba(56,0,103,.4);
  transform: translateY(-1px);
}

.btn--secondary {
  background: transparent;
  color: var(--purple-700);
  border: 2px solid var(--purple-700);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--purple-100);
}

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border: 2px solid var(--border);
}

.btn--ghost:hover:not(:disabled) { 
  background: var(--purple-50); 
}

.btn--header {
  background: transparent;
  color: #020202;
  border: 2px solid var(--border);
}

.btn--header:hover:not(:disabled) { 
  background: var(--purple-50); 
  color: black;
}

.btn--full { width: 100%; }
.btn--xl   { min-height: var(--tap-xl); font-size: 20px; border-radius: var(--radius); }
.btn--sm   { min-height: 48px; font-size: 16px; padding: 0 20px; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card--flush { padding: 0; overflow: hidden; }

/* ── INPUTS ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 12px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

label {
  font-size: 16px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .1px;
  margin-bottom: 4px;
}
.label-req { color: var(--error); margin-left: 2px; }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="tel"],
select {
  height: 64px;
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 24px;
  font-size: 18px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
  font-weight: 500;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--purple-700);
  box-shadow: 0 0 0 4px rgba(56,0,103,.15);
  transform: scale(1.02);
}
input.input--error, select.input--error {
  border-color: var(--error);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%237e3aa3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}

/* ── ALERTAS ────────────────────────────────────────────────── */
.fpm-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1.5;
  border: 1px solid;
  margin-bottom: 16px;
}
.fpm-alert--error   { background: var(--error-lt);   color: var(--error);   border-color: #e0b0aa; }
.fpm-alert--warning { background: var(--warning-lt); color: var(--warning); border-color: #e5c97a; }
.fpm-alert--success { background: var(--success-lt); color: var(--success); border-color: #d4b5ff; }
.fpm-alert--info    { background: var(--purple-100);  color: var(--purple-800); border-color: var(--border-dk); }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.modal-show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.modal.modal-hide {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
  cursor: pointer;
}

.modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.modal-body {
  padding: 24px;
}

.form-help {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
  font-style: italic;
}

.form-actions {
  margin-top: 24px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-control {
  flex: 1;
  padding-right: 48px;
}

.btn-password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  z-index: 2;
}

.btn-password-toggle:hover {
  background-color: var(--purple-50);
}

.eye-icon {
  font-size: 16px;
  line-height: 1;
  display: block;
  color: var(--text-2);
  transition: color 0.2s ease;
  width: 16px;
  height: 16px;
}

.btn-password-toggle:hover .eye-icon {
  color: var(--primary);
}

.btn-password-toggle[data-visible="true"] .eye-icon {
  color: var(--primary);
}

.btn-password-toggle {
  padding: 8px 10px;
  min-width: 36px;
}

.modal-actions {
  margin-top: 24px;
}

/* ── LEYENDA DE ESCALA ───────────────────────────────── */
.scale-legend {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem;
  margin-bottom: 1rem;
}

.scale-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scale-legend-icon {
  flex-shrink: 0;
}

.scale-legend-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--white);
}

.scale-legend-lbl {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Números con círculos de color (solo borde, sin fondo) */
.scale-legend-item--0 .scale-legend-num {
  background: transparent;
  border: 3px solid #bfcc0e;
}

.scale-legend-item--1 .scale-legend-num {
  background: transparent;
  border: 3px solid #ffcc07;
}

.scale-legend-item--2 .scale-legend-num {
  background: transparent;
  border: 3px solid #f49819;
}

.scale-legend-item--3 .scale-legend-num {
  background: transparent;
  border: 3px solid #ec6922;
}

.scale-legend-item--4 .scale-legend-num {
  background: transparent;
  border: 3px solid #e6322a;
}

/* ── SLIDER DE DOLOR GLOBAL ───────────────────────────────────── */
.sat-wrap { 
  padding: 1.5rem 1rem 1.5rem;
  max-width: 680px;
  width: 100%;
  background: #fff;
  margin: 1rem auto;
}

.sat-label {
  font-size: 13px;
  color: #999;
  margin-bottom: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Número grande */
.sat-big {
  font-size: 64px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  margin-bottom: 1.2rem;
  min-height: 72px;
  transition: color 0.2s;
  color: #222;
}
.sat-big span {
  display: inline-block;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1);
}

/* Fila de números */
.sat-num-row {
  display: flex;
  gap: 3px;
  margin-bottom: 5px;
  user-select: none;
  touch-action: none;
}
.sat-num {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, border-color 0.15s;
  color: #858383;
  border: 0.5px solid #ddd;
  background: #fff;
  touch-action: manipulation;
}
.sat-num:active { transform: scale(0.9); }

/* Barra de colores */
.sat-bar-row {
  display: flex;
  gap: 3px;
  user-select: none;
  touch-action: none;
  cursor: pointer;
}
.sat-seg {
  flex: 1;
  height: 18px;
  border-radius: 4px;
  transition: opacity 0.18s;
  opacity: 0.15;
}

/* Hint */
.sat-hint {
  font-size: 12px;
  color: #111;
  font-weight: 600;
  text-align: center;
  margin-top: 0.7rem;
  margin-bottom: 1.4rem;
}

/* Fila de caras */
.faces-row {
  display: flex;
  gap: 4px;
}
.face-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  cursor: pointer;
  touch-action: manipulation;
}
.face-item:active { transform: scale(0.95); }
.face-item svg {
  width: 40px;
  height: 40px;
  transition: transform 0.2s;
}
.face-item.active svg { transform: scale(1.18); }
.face-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: #333;
  transition: color 0.2s;
}
.face-range {
  font-size: 10px;
  font-weight: 600;
  color: #888;
  text-align: center;
}

/* ── LOADER ─────────────────────────────────────────────────── */
#fpm-loader[hidden] {
  display: none !important;
}
#fpm-loader {
  position: fixed;
  inset: 0;
  background: rgba(56,0,103,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.loader-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 52px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.loader-spinner {
  width: 52px; height: 52px;
  border: 5px solid var(--purple-200);
  border-top-color: var(--purple-600);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 15px; color: var(--text-2); font-weight: 300; }

/* ── TOAST ──────────────────────────────────────────────────── */
#fpm-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  padding: 14px 28px;
  border-radius: 40px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
#fpm-toast.fpm-toast--show { transform: translateX(-50%) translateY(0); opacity: 1; }
#fpm-toast.fpm-toast--success { background: var(--purple-700); color: white; }
#fpm-toast.fpm-toast--error   { background: var(--error);     color: white; }
#fpm-toast.fpm-toast--warning { background: var(--gold);      color: white; }
#fpm-toast.fpm-toast--info,
#fpm-toast                    { background: var(--text);       color: white; }

/* ════════════════════════════════════════════════════════════
   PÁGINA LOGIN
════════════════════════════════════════════════════════════ */
#page-login {
  background: linear-gradient(150deg, var(--purple-900) 0%, var(--purple-700) 60%, var(--purple-500) 100%);
  position: relative;
  overflow: hidden;
}
#page-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Ccircle cx='50' cy='50' r='120' fill='rgba(255,255,255,.03)'/%3E%3Ccircle cx='350' cy='350' r='180' fill='rgba(255,255,255,.03)'/%3E%3Ccircle cx='350' cy='80' r='80' fill='rgba(255,255,255,.02)'/%3E%3C/svg%3E");
  background-size: cover;
}

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  z-index: 1;
}

.login-box {
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 52px 44px;
  width: 100%;
  max-width: 460px;
  animation: slideUp .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo-img {
  height: 52px;
  width: auto;
  margin-bottom: 16px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.login-logo-fallback {
  display: none;
}
.login-logo-fallback:not([hidden]) {
  display: block;
}
.login-logo-fallback .logo-icon {
  width: 72px; height: 72px;
  background: var(--purple-700);
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-title {
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.2;
}
.login-sub {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
  font-family: 'DIN Next LT Pro', var(--font-sans);
  text-align: center;
  margin-bottom: 32px;
  text-transform: uppercase;
}

.login-fields { display: flex; flex-direction: column; gap: 20px; }
.form-group--remember { margin-top: -8px; }
.form-group--remember .checkbox-label { padding: 10px 14px; background: transparent; border: 1px solid #e2e8f0; }

.login-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}

.login-forgot {
  margin-top: 14px;
  text-align: center;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--purple-700);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
}
.btn-link:hover { color: var(--purple-900); }

.forgot-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}

/* ════════════════════════════════════════════════════════════
   PÁGINA BÚSQUEDA
════════════════════════════════════════════════════════════ */
.search-hero {
  background: linear-gradient(135deg, var(--purple-800) 0%, var(--purple-600) 100%);
  color: white;
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.search-hero-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: .7;
  margin-bottom: 6px;
}
.search-hero-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}
.search-hero-sub {
  font-size: 14px;
  opacity: .75;
}

.search-input-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.search-input-wrap .form-group { flex: 1; }
.search-input-wrap .btn { flex-shrink: 0; padding: 0 36px; }

/* Input de búsqueda por nombre — grande para tablet */
#search-nombre {
  font-size: 24px;
  font-weight: 500;
  font-family: var(--font-sans);
  height: 80px;
  border-radius: var(--radius);
  border-width: 3px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Dropdown de resultados predictivos */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  margin-top: -4px;
}

.search-result-item {
  padding: 16px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background .15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--purple-50);
}

.search-result-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.search-result-meta {
  font-size: 13px;
  color: var(--text-3);
}

.search-result-num {
  font-size: 12px;
  color: var(--purple-600);
  font-weight: 500;
}

/* Indicador de "No encontrado" */
.search-not-found {
  padding: 20px;
  background: var(--warning-lt);
  border: 1px solid #e5c97a;
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.not-found-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.not-found-icon {
  font-size: 24px;
}

.not-found-text {
  font-size: 15px;
  color: var(--text-2);
  flex: 1;
}

/* Banner de cliente generado */
.cliente-generado-banner {
  background: linear-gradient(135deg, var(--purple-800) 0%, var(--purple-600) 100%);
  color: white;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  text-align: center;
}

.cg-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: .8;
  margin-bottom: 4px;
}

.cg-value {
  font-size: 28px;
  font-weight: 700;
  font-family: 'DIN Next Rounded LT Pro', var(--font-sans);
  letter-spacing: 2px;
}

/* Resultados */
.search-result { display: flex; flex-direction: column; gap: 16px; }

.result-card {
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  border: 1.5px solid;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.result-card--new     { background: var(--purple-50); border-color: var(--purple-400); }
.result-card--ready   { background: var(--purple-100); border-color: var(--purple-500); }
.result-card--blocked { background: var(--warning-lt); border-color: #e5c97a; }
.result-card--done    { background: var(--success-lt); border-color: #d4b5ff; }

.result-icon  { font-size: 32px; flex-shrink: 0; line-height: 1; }
.result-title { 
  font-weight: 700; 
  font-size: 17px; 
  margin-bottom: 6px; 
  color: var(--text);
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-sans);
}
.result-msg   { 
  font-size: 15px; 
  color: var(--text-2); 
  line-height: 1.5;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}

.days-left-badge {
  display: inline-block;
  margin-top: 12px;
  background: var(--gold);
  color: white;
  padding: 8px 20px;
  border-radius: 24px;
  font-size: 20px;
}
.available-date {
  margin-top: 8px;
  font-size: 14px;
  color: var(--warning);
}

/* ── CARD PACIENTE ──────────────────────────────────────────── */
.patient-card {
  background: var(--white);
  border: 1.5px solid var(--border-dk);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.patient-card-icon {
  width: 48px; height: 48px;
  background: var(--purple-200);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: var(--purple-700);
  flex-shrink: 0;
}
.patient-card-id   { 
  font-weight: 700; 
  font-size: 18px; 
  letter-spacing: .5px;
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-sans);
}
.patient-card-meta { 
  font-size: 14px; 
  color: var(--text-2); 
  margin-top: 2px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}
.patient-card-name { 
  font-size: 20px; 
  font-weight: 700; 
  color: var(--text);
  font-family: 'DIN Next LT Pro', var(--font-sans);
  margin-bottom: 4px;
}
.patient-card-email { 
  font-size: 13px; 
  color: var(--purple-700); 
  margin-top: 4px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
  margin-left: auto;
}
.badge--success { background: var(--success-lt); color: var(--success); border: 1px solid #d4b5ff; }
.badge--active  { background: var(--purple-100);  color: var(--purple-800); border: 1px solid var(--border-dk); }

/* ════════════════════════════════════════════════════════════
   PÁGINA NUEVO PACIENTE
════════════════════════════════════════════════════════════ */
.page-back-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.page-heading {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--purple-900);
}
.page-heading-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--purple-700);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ════════════════════════════════════════════════════════════
   CUESTIONARIO EVA-WOMAC
════════════════════════════════════════════════════════════ */

/* Header de fase */
.q-phase-header {
  background: linear-gradient(135deg, var(--purple-800) 0%, var(--purple-600) 100%);
  color: white;
  padding: 24px 28px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -28px -28px 28px;
}
.q-phase-label {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.q-phase-protocol {
  font-size: 13px;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 16px;
}

/* Progreso */
.q-progress-wrap { display: flex; align-items: center; gap: 12px; }
.q-progress-bar  { flex: 1; height: 6px; background: rgba(255,255,255,.25); border-radius: 3px; overflow: hidden; }
.q-progress-fill { height: 100%; background: rgba(255,255,255,.9); border-radius: 3px; transition: width .3s; }
.q-progress-text { font-size: 13px; opacity: .8; white-space: nowrap; min-width: 60px; text-align: right; }

/* Leyenda de escala */
.scale-legend {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.scale-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  flex: 1;
  min-width: 80px;
}
/* Grupo de preguntas */
.q-group { margin-bottom: 32px; }
.q-group-header { margin-bottom: 4px; }
.q-group-title {
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-800);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--purple-200);
  margin-bottom: 2px;
}
.q-group-sub {
  font-size: 16px;
  color: var(--text-2);
  font-style: italic;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Fila de pregunta */
.q-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.q-row:last-child { border-bottom: none; }
.q-row--unanswered { background: var(--error-lt); margin: 0 -28px; padding: 16px 28px; border-radius: 0; }
.q-row--unanswered .q-text { color: var(--error); }

.q-text {
  font-size: 16px;
  color: var(--text);
  line-height: 1.4;
  font-weight: 400;
}
.q-required { color: var(--error); margin-left: 3px; }

/* Escala de opciones — táctil optimizado */
.q-scale {
  display: flex;
  gap: 12px;
}

.scale-opt {
  flex: 1;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.scale-radio { display: none; }

.scale-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 80px;
  min-height: 72px;
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: all .15s;
  padding: 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.scale-face:active {
  transform: scale(0.95);
  background: var(--purple-100);
}
.scale-face-num { 
  font-size: 20px; 
  font-weight: 800; 
  line-height: 1; 
  color: var(--text-2); 
  display: none; 
}
.scale-face-lbl { 
  font-size: 12px; 
  color: var(--text-2); 
  text-align: center; 
  line-height: 1.2; 
}

/* Seleccionado */
.scale-opt--0 .scale-radio:checked ~ .scale-face { background: #bfcc0e; border-color: #bfcc0e; }
.scale-opt--1 .scale-radio:checked ~ .scale-face { background: #ffcc07; border-color: #ffcc07; }
.scale-opt--2 .scale-radio:checked ~ .scale-face { background: #f49819; border-color: #f49819; }
.scale-opt--3 .scale-radio:checked ~ .scale-face { background: #ec6922; border-color: #ec6922; }
.scale-opt--4 .scale-radio:checked ~ .scale-face { background: #e6322a; border-color: #e6322a; }

.scale-opt .scale-radio:checked ~ .scale-face .scale-face-num,
.scale-opt .scale-radio:checked ~ .scale-face .scale-face-lbl { color: white; }
.scale-opt--1 .scale-radio:checked ~ .scale-face .scale-face-num,
.scale-opt--1 .scale-radio:checked ~ .scale-face .scale-face-lbl { color: var(--text); }

/* ── NOTIFICATIONS ───────────────────────────────────────────────── */
.header-notifications {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 12px;
  cursor: pointer;
}

.notification-icon {
  font-size: 18px;
  color: #020202;
  transition: transform 0.2s ease;
}

.header-notifications:hover .notification-icon {
  transform: scale(1.1);
}

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e6322a;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 1;
}

.notification-tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 12px;
  min-width: 350px;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.header-notifications:hover .notification-tooltip {
  opacity: 1;
  visibility: visible;
}

.notification-content {
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  font-family: 'DIN Next LT Pro', var(--font-sans);
}

.notification-item {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

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

.notification-patient {
  font-weight: 600;
  color: var(--purple-800);
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-sans);
}

.notification-time {
  font-size: 13px;
  color: var(--text-2);
  font-weight: bold;
  margin-top: 2px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}

/* ── TIMELINE ───────────────────────────────────────────────── */
.timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.timeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.timeline-connector {
  flex: 1;
  height: 3px;
  margin-top: 18px;
  background: var(--border);
  align-self: flex-start;
}
.timeline-step--done    .timeline-connector,
.timeline-step--active  .timeline-connector { background: var(--purple-500); }

.timeline-dot {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  border: 4px solid var(--border);
  background: var(--white);
  color: var(--text-2);
  position: relative;
  z-index: 1;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.timeline-step--done   .timeline-dot { background: var(--purple-600); border-color: var(--purple-600); color: white; }
.timeline-step--active .timeline-dot { background: var(--purple-800); border-color: var(--purple-800); color: white; box-shadow: 0 0 0 4px var(--purple-200); }

.timeline-info   { text-align: center; margin-top: 8px; }
.timeline-label  { 
  display: block; 
  font-size: 13px; 
  font-weight: 600; 
  color: var(--text);
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-sans);
}
.timeline-sub    { 
  display: block; 
  font-size: 11px; 
  color: var(--text-2); 
  margin-top: 1px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}
.timeline-date   { 
  display: block; 
  font-size: 10px; 
  color: var(--purple-600); 
  margin-top: 3px; 
  font-weight: 600;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}
.timeline-step--active .timeline-label { color: var(--purple-800); }

/* ════════════════════════════════════════════════════════════
   PÁGINA AGRADECIMIENTO
════════════════════════════════════════════════════════════ */
#page-thanks {
  background: linear-gradient(150deg, var(--purple-900) 0%, var(--purple-700) 60%, var(--purple-500) 100%);
}
.thanks-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
}
.thanks-box {
  background: var(--white);
  border-radius: 24px;
  padding: 60px 44px;
  text-align: center;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp .5s cubic-bezier(.34,1.56,.64,1);
}
.thanks-icon {
  width: 100px; height: 100px;
  background: var(--purple-100);
  border-radius: 50%;
  margin: 0 auto 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  color: var(--purple-700);
}
.thanks-title {
  font-family: 'DIN Next Rounded LT Pro', 'DIN Next LT Pro', var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.2;
}
.thanks-msg {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 12px;
  font-family: 'DIN Next LT Pro', var(--font-sans);
}
.thanks-actions {
  margin: 28px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
}
.thanks-brand {
  margin: 28px 0;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
}
.thanks-brand-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.thanks-code {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 24px;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE TABLET 11"
════════════════════════════════════════════════════════════ */
@media (min-width: 700px) {
  .q-row {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }
  .q-text { flex: 1; }
  .q-scale { flex-shrink: 0; }
}

@media (max-width: 600px) {
  .form-row   { grid-template-columns: 1fr; }
  .form-row--3 { grid-template-columns: 1fr 1fr; }
  .card { padding: 20px; }
  .q-phase-header { padding: 20px; margin: -20px -20px 20px; }
  .login-box { padding: 36px 28px; }
  .thanks-box { padding: 44px 28px; }
  .scale-face { min-height: 48px; }
  .scale-face-num { font-size: 17px; }
  .scale-face-lbl { font-size: 9px; }
}

/* ── CLASES AUXILIARES ── */
.btn--search         { padding: 0 40px; }
#search-alert        { margin-top: 16px; }

/* ── ESTADOS DE FASES ── */
.patient-card-phases {
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.phase-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--color-bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.phase-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

.phase-detail {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.phase-days {
  font-size: 11px;
  color: var(--color-accent);
  font-weight: 500;
  margin-top: 2px;
}

@media (max-width: 600px) {
  .phase-item {
    padding: 6px;
  }
  .phase-status {
    font-size: 12px;
  }
  .phase-detail {
    font-size: 11px;
  }
  .phase-days {
    font-size: 10px;
  }
}
.patient-fields      { display: flex; flex-direction: column; gap: 18px; }
.card--timeline      { padding: 20px 28px; }
.thanks-msg--small   { font-size: 15px; margin-top: 8px; }
.thanks-logo-img     { height: 28px; }
.login-logo-fallback { display: none; }
.login-logo-fallback:not([hidden]) { display: block; }
.visually-hidden     { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }

/* ════════════════════════════════════════════════════════════
   PÁGINA ESTADÍSTICAS (Chart.js)
════════════════════════════════════════════════════════════ */

/* Grid de tarjetas de resumen */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 700px) {
  .stats-summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.card--stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--purple-700);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

/* Distribución por fases */
.stats-phases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.phase-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--purple-50);
  border-radius: var(--radius-sm);
}

.phase-indicator {
  width: 12px;
  height: 40px;
  border-radius: 6px;
  flex-shrink: 0;
}

.phase-indicator.phase-1 { background: linear-gradient(180deg, #380067 0%, #5c2a8d 100%); }
.phase-indicator.phase-2 { background: linear-gradient(180deg, #7e3aa3 0%, #a855f7 100%); }
.phase-indicator.phase-3 { background: linear-gradient(180deg, #52b788 0%, #86efac 100%); }

.phase-info { flex: 1; }

.phase-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.phase-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-700);
  margin-top: 4px;
}

/* Contenedores de gráficas Chart.js */
.chart-container {
  position: relative;
  height: 300px;
  margin-top: 16px;
}

.chart-container-sm {
  position: relative;
  height: 250px;
  margin-top: 16px;
}

/* Grid de gráficas adicionales - 2x2 para tablet horizontal */
.stats-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  padding: 20px;
}

.chart-card .section-title {
  font-size: 14px;
  margin-bottom: 8px;
}

/* Tabla de pacientes */
.stats-table-container {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.stats-table th {
  background: var(--purple-50);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--purple-700);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.stats-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.stats-table tr:last-child td {
  border-bottom: none;
}

.stats-table tr:hover td {
  background: var(--purple-50);
}

/* Badges de estado */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge--success {
  background: #dcfce7;
  color: #166534;
}

.badge--active {
  background: var(--purple-100);
  color: var(--purple-700);
}

/* ════════════════════════════════════════════════════════════
   GRÁFICAS WOMAC - PIE CHARTS
════════════════════════════════════════════════════════════ */
.womac-pie-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

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

.pie-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pie-wrapper {
  position: relative;
  width: 240px;
  height: 280px;
}

/* ════════════════════════════════════════════════════════════
   GRÁFICAS DE EVOLUCIÓN (VAS + WOMAC con barras de error)
════════════════════════════════════════════════════════════ */
.evolution-charts-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 20px;
}

.evolution-charts-grid .evolution-chart-container {
  width: 100%;
}

.evolution-charts-grid .chart-wrapper {
  width: 100%;
  height: 220px;
}

.evolution-chart-container {
  display: flex;
  flex-direction: column;
}

.chart-legend-small {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--gray-600);
}

.chart-legend-small .legend-item {
  background: var(--purple-50);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════
   MODAL DE CONSENTIMIENTO (Acuerdo de Colaboración)
════════════════════════════════════════════════════════════ */

/* Asegurar que el modal se muestre cuando no tiene hidden */
#consent-modal {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 99999 !important;
  background: rgba(0,0,0,0.5) !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#consent-modal[hidden] {
  display: none !important;
}

/* Ajustar overlay y card del consent-modal */
#consent-modal .modal-overlay {
  z-index: 1;
}

#consent-modal .modal-card {
  position: relative !important;
  z-index: 2 !important;
  max-width: 900px !important;
  max-height: 95vh !important;
  overflow-y: auto !important;
  pointer-events: auto !important;
}

#consent-modal .modal-card--large {
  max-width: 900px !important;
}

#consent-modal .modal-body {
  position: relative !important;
  z-index: 3 !important;
  overflow-y: auto !important;
  max-height: calc(95vh - 120px) !important;
  pointer-events: auto !important;
}

#consent-modal .consent-content {
  position: relative !important;
  z-index: 4 !important;
  pointer-events: auto !important;
}

#consent-modal .consent-form {
  position: relative !important;
  z-index: 4 !important;
  pointer-events: auto !important;
}

.modal--fullscreen .modal-card {
  max-width: 900px;
  max-height: 95vh;
  overflow-y: auto;
}

.consent-content {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  max-height: 450px;
  overflow-y: auto;
}

.consent-subtitle {
  text-align: center;
  color: var(--purple-700);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--purple-200);
}

.consent-section {
  margin-bottom: 24px;
  padding: 16px;
  background: white;
  border-radius: 8px;
  border-left: 4px solid var(--purple-500);
}

.consent-section-title {
  color: var(--purple-700);
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
}

.consent-section-content {
  line-height: 1.8;
  color: var(--text-2);
  font-size: 14px;
  text-align: justify;
}

.consent-signatures-row {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  justify-content: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px dashed #ddd;
}

.consent-signatures-title {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  width: 100%;
  flex-basis: 100%;
}

/* Firmas fijas de AlchemLife - siempre visibles */
.consent-signatures-fixed {
  background: linear-gradient(135deg, #e8f5e8 0%, #f0f9ff 100%);
  border: 2px solid #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
  position: relative;
  border-radius: 12px;
  padding: 24px;
}

.consent-signatures-fixed::before {
  content: "⚖️ DOCUMENTO LEGAL";
  position: absolute;
  top: -12px;
  right: 16px;
  background: #10b981;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.consent-signatures-fixed .consent-signatures-title {
  color: #065f46;
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  margin-bottom: 16px;
}

.consent-signature-block {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.consent-signature-img {
  max-width: 200px;
  max-height: 100px;
  margin-bottom: 8px;
}

.signature-placeholder {
  width: 200px;
  height: 100px;
  border: 2px dashed #dc2626;
  border-radius: 8px;
  background: #fef2f2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
}

.signature-placeholder small {
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.2;
}

.consent-signature-info {
  text-align: center;
  margin-top: 8px;
}

.consent-signature-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.consent-signature-role {
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
}

.consent-form {
  background: white;
  border: 2px solid var(--purple-200);
  border-radius: 12px;
  padding: 24px;
}

.consent-section-number {
  color: var(--purple-700);
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--purple-200);
}

.consent-form-title {
  color: var(--purple-700);
  margin-bottom: 20px;
  font-size: 20px;
  text-align: center;
}

.signature-pad-container {
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  position: relative;
}

.signature-pad {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
}

.signature-pad-actions {
  position: absolute;
  top: 10px;
  right: 10px;
}

.consent-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  height: auto;
  min-height: auto;
}

.checkbox-label:hover {
  background: #f0f0f0;
}

.checkbox-label input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--purple-600);
}

.checkbox-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  display: block;
  white-space: normal;
  word-wrap: break-word;
}

.consent-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--purple-600);
  text-decoration: underline;
  font-size: 13px;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* Responsive: en móvil los botones se apilan */
@media (max-width: 600px) {
  .modal-footer {
    flex-direction: column-reverse;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
}

/* Estilos adicionales para consentimiento AlchemLife RGPD */
.checkbox-label--required {
  border-left: 3px solid #dc2626;
  background: #fef2f2;
}

.checkbox-label--required:hover {
  background: #fee2e2;
}

.checkbox-label--optional {
  border-left: 3px solid #6b7280;
  background: #f9fafb;
}

.checkbox-label--optional:hover {
  background: #f3f4f6;
}

.checkbox-hint {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: #6b7280;
  color: white;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.consent-notice {
  margin-top: 20px;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #1e40af;
}

.consent-notice.consent-notice--info {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.consent-notice.consent-notice--info strong {
  color: #15803d;
}

.consent-notice.consent-notice--info a {
  color: #16a34a;
}

.consent-notice p {
  margin: 0 0 8px 0;
}

.consent-notice p:last-child {
  margin-bottom: 0;
}

.consent-notice strong {
  color: #1e3a8a;
}

.consent-notice a {
  color: #2563eb;
  text-decoration: underline;
}
/* ── Tablas resumen por paciente ─────────────────────────── */
.patient-table-block {
  margin-bottom: 32px;
}
.patient-table-block .chart-title {
  margin-bottom: 10px;
}
.patient-summary-table tfoot tr td {
  font-weight: 600;
  background: #f5f0fa;
}
.patient-summary-table tfoot .row-promedio td { background: #ede9f7; }
.patient-summary-table tfoot .row-desviacion td { background: #f5f0fa; }
.patient-summary-table tfoot .row-error td { background: #faf8fe; }

/* ── Stats tabs ──────────────────────────────────────────── */
.stats-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0;
}
.stats-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s;
}
.stats-tab:hover { color: #380067; }
.stats-tab--active {
  color: #380067;
  border-bottom-color: #380067;
  font-weight: 600;
}
.stats-tab-panel[hidden] { display: none; }

/* ── WOMAC detail tables ─────────────────────────────────── */
.womac-detail-scroll { overflow-x: auto; }
.womac-detail-table { min-width: 900px; font-size: 0.78rem; }
.womac-detail-table th, .womac-detail-table td { padding: 5px 7px; text-align: center; white-space: nowrap; }
.womac-detail-table .col-sticky {
  position: sticky; left: 0; background: #fff; z-index: 1;
  text-align: left; min-width: 90px;
}
.womac-detail-table thead .col-sticky { background: #f3eef9; }
.womac-detail-table .col-total { font-weight: 600; background: #f9f7ff; }
.womac-detail-table tfoot .row-recuento td { background: #ede9f7; font-weight: 600; }
.womac-detail-table tfoot .row-pct td { background: #f5f0fa; }
.womac-detail-table tfoot .col-sticky { background: #ede9f7 !important; }
.womac-detail-table tfoot .row-pct .col-sticky { background: #f5f0fa !important; }
.scale-range { font-size: 0.78rem; color: #6b7280; font-weight: 400; margin-left: 8px; }

/* ── EVA VAS Scale Visual ────────────────────────────────── */
.eva-vas-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  padding: 20px;
  background: #f8f7fb;
  border-radius: 12px;
}
.eva-vas-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #4c1d95;
  color: #fff;
  border-radius: 10px;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.eva-vas-summary-title { font-weight: 700; font-size: 0.88rem; white-space: nowrap; }
.eva-vas-reduction { font-size: 1.1rem; font-weight: normal; color: #a3e635; white-space: nowrap; }
.eva-vas-range { font-size: 0.82rem; opacity: 0.82; font-style: italic; white-space: nowrap; }

.eva-vas-scale { flex: 1; min-width: 0; }

.eva-vas-arrows {
  position: relative;
  height: 72px;
}
.eva-vas-arrow-group {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}
.eva-vas-arrow-icon { font-size: 1rem; line-height: 1; }

.eva-vas-bar {
  height: 30px;
  border-radius: 5px;
  background: linear-gradient(to right,
    #22c55e 0%, #84cc16 20%, #facc15 35%,
    #f97316 55%, #ef4444 75%, #dc2626 100%);
}

.eva-vas-ticks {
  position: relative;
  height: 20px;
  margin-top: 3px;
}
.eva-vas-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #6b7280;
  top: 0;
}

.eva-face-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 2px;
}
.eva-face-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid;
  line-height: 1.4;
  white-space: nowrap;
}

