/**
 * Mi CIMA — app pública del paciente
 * Archivo  : app/style/mi.css
 * Función  : Estilos de la app. Mismo look del portal del paciente (tarjeta de vidrio, titlebar con el
 *            isotipo, dock glossy con orbe), con la paleta oficial D: navy #04346C + teal #00AFC2.
 *            Claro/oscuro sigue al teléfono vía html[data-pp-scheme] (lo pone app.js).
 *            Solo tokens --pp-*; nada de colores sueltos fuera de este bloque.
 */
/* Apariencia de BASE móvil (base-mobile/style/mobile.css): claro = esquema «landing», oscuro = «glass-oscuro» sin las
   manchas de fondo (regla del landing: sin degradados de color de fondo). Tokens --m-* tal cual; los --pp-* salen de ellos.
   Contraste (WCAG, calculado): el naranja de BASE #e55a00 solo da 3,6:1 con blanco, así que sirve para íconos y el orbe
   (gráficos, ≥3:1) pero no para texto: los botones y el texto de acento usan --pp-btn / --pp-ink (#b83c00, 5,7:1 con blanco;
   en oscuro #ff9f0a, 9,4:1 con el fondo). Verde de éxito y rojo de peligro en claro también van oscurecidos para texto. */
:root {
    --primary: #04346C;
    --primary-2: #0A5AA8;
    --accent: #00AFC2;
    --accent-2: #5FD6E3;
    --ok: #2DD4A7;
    --cima-navy: var(--primary);
    --cima-teal: var(--accent);
    --ppd-h: 66px;
    /* Nombres que usa app/ui/avatar.js (copia tal cual de cima-desktop): se mapean a los tokens. */
    --glass-border: var(--pp-border);
    --glass-bg: var(--pp-surface-2);
    --text-main: var(--pp-text);

    /* Oscuro (por defecto; app.js pone data-pp-scheme según el teléfono) = glass-oscuro de BASE */
    --m-bg: #0b0d14; --m-surface: rgba(255, 255, 255, .07); --m-surface-2: rgba(40, 44, 58, .74); --m-bar: rgba(30, 33, 44, .86);
    --m-line: rgba(255, 255, 255, .12); --m-fg: #f5f7fb; --m-muted: #a4abbd; --m-on: #0b0d14;
    --m-c1: #64d2ff; --m-c2: #ffd60a; --m-c3: #da8fff; --m-c4: #30d158; --m-c5: #7d7aff; --m-bad: #ff453a; --m-acc: #ff9f0a;
    --pp-logo: url('/app/style/icon/cima_logo_oscuro.svg?v=20261109h');
    --pp-bg: var(--m-bg);
    --pp-bg-2: #12151d;
    --pp-surface: var(--m-surface);
    --pp-surface-2: color-mix(in srgb, var(--m-fg) 9%, transparent);
    --pp-solid: #1a1d27;
    --pp-border: var(--m-line);
    --pp-text: var(--m-fg);
    --pp-text-muted: var(--m-muted);
    --pp-primary: var(--m-acc);
    --pp-accent: var(--m-acc);
    --pp-ink: #ff9f0a;
    --pp-btn: #ff9f0a;
    --pp-on-btn: #0b0d14;
    --pp-dock-bar: var(--m-bar);
    --pp-shadow: none;
    --pp-success: var(--m-c4);
    --pp-on-success: #0b0d14;
    --pp-danger: var(--m-bad);
    --pp-warn: var(--m-c2);
    --pp-line-2: var(--m-c1);
}
html[data-pp-scheme="light"] {
    color-scheme: light;
    /* Claro = «landing» de BASE (el mismo de appcima.com) */
    --m-bg: #f7fafd; --m-surface: #ffffff; --m-surface-2: #edf2f8; --m-bar: #ffffff; --m-line: #d9e3ee;
    --m-fg: #0a2540; --m-muted: #5b6b80; --m-on: #ffffff;
    --m-c1: #0098aa; --m-c2: #c97a0a; --m-c3: #0a5aa8; --m-c4: #12996f; --m-c5: #04346c; --m-bad: #d93a3a; --m-acc: #e55a00;
    --pp-logo: url('/app/style/icon/cima_logo.svg?v=20260817mc18');
    --pp-bg-2: #edf2f8;
    --pp-surface-2: var(--m-surface-2);
    --pp-solid: #ffffff;
    --pp-ink: #b83c00;
    --pp-btn: #b83c00;
    --pp-on-btn: #ffffff;
    --pp-shadow: 0 1px 2px rgba(10, 37, 64, .06);
    --pp-success: #0b7a57;
    --pp-on-success: #ffffff;
    --pp-danger: #c42f2f;
    --pp-warn: #b45309;
}
html { color-scheme: dark; background: var(--pp-bg); }

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100%; overscroll-behavior: none; touch-action: pan-x pan-y; }
body {
    font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--pp-text); background: var(--pp-bg);
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-font-smoothing: antialiased;
}
input, textarea, select { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* Marca: la palabra CIMA se dibuja con el logo oficial (app/core/brandword.js). */
.cima-word { display: inline-block; height: .95em; aspect-ratio: 251.5 / 76; vertical-align: -.06em; margin: 0 .06em; background: var(--pp-logo) no-repeat center / contain; }
.mi-h1 .cima-word, .mi-h2 .cima-word, .mi-sheet-head .cima-word { height: .95em; vertical-align: -.1em; }
.mi-brand { display: inline-flex; align-items: center; font-weight: 700; letter-spacing: -.01em; color: var(--pp-primary); }
.mi-brand .cima-word { height: 1.08em; margin: 0; vertical-align: 0; }
.pp-tb-text { display: flex; flex-direction: column; align-items: flex-start; }
.pp-tb-text .mi-brand { font-size: 1.5rem; }
.mi-slogan { display: block; font-family: Roboto, sans-serif; font-size: .68rem; font-weight: 500; color: var(--pp-text-muted); letter-spacing: .02em; margin-top: 3px; }
html:not([data-pp-scheme="light"]) .mi-brand { color: var(--pp-text); }
/* Sobre fondos invertidos (banner navy, aviso flotante) el logo va con el contraste contrario. */
html[data-pp-scheme="light"] .mi-toast .cima-word { background-image: url('/app/style/icon/cima_logo_oscuro.svg?v=20261109h'); }
html:not([data-pp-scheme="light"]) .mi-toast .cima-word { background-image: url('/app/style/icon/cima_logo.svg?v=20260817mc18'); }

/* ── Marco: tarjeta centrada (el portal en el teléfono ocupa todo) ── */
#pp-root {
    min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center;
    background: var(--pp-bg);
}
#pp-card {
    position: relative; width: 100%; max-width: 520px;
    height: 100vh; height: 100dvh; overflow: hidden;
    display: flex; flex-direction: column;
}
.pp-titlebar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 10px 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
    min-height: 56px; flex-shrink: 0; background: transparent;
}
.pp-tb-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pp-tb-text { font-family: 'Roboto Condensed', Roboto, sans-serif; font-size: 1.3rem; line-height: 1.1; font-weight: 700; color: var(--pp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-tb-text small { display: block; font-family: Roboto, sans-serif; font-size: .68rem; font-weight: 500; color: var(--pp-text-muted); letter-spacing: .02em; }
.pp-tb-act { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.pp-tb-btn {
    width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; border: none; background: transparent; color: var(--pp-text-muted);
    font-size: 1.2rem; cursor: pointer; -webkit-appearance: none;
}
.pp-tb-btn:active { transform: scale(.93); background: var(--pp-surface-2); }

#pp-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 16px calc(var(--ppd-h) + 44px + env(safe-area-inset-bottom, 0px)); }
.mi-view { animation: mi-in .28s ease both; }
@keyframes mi-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Tipografía y bloques ── */
.mi-h1 { font-family: 'Roboto Condensed', Roboto, sans-serif; font-size: 1.5rem; font-weight: 700; margin: 2px 0 4px; line-height: 1.15; }
.mi-sub { color: var(--pp-text-muted); font-size: .9rem; margin: 0 0 16px; line-height: 1.45; }
.mi-h2 { font-family: 'Roboto Condensed', Roboto, sans-serif; font-size: 1.05rem; font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.mi-h2 .bi { color: var(--pp-ink); }
.mi-card {
    background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 18px;
    padding: 16px; margin-bottom: 12px; box-shadow: var(--pp-shadow);
    -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
}
.mi-row { display: flex; align-items: center; gap: 12px; }
.mi-grow { flex: 1; min-width: 0; }
.mi-muted { color: var(--pp-text-muted); }
.mi-small { font-size: .8rem; }
.mi-note { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; line-height: 1.45; color: var(--pp-text-muted); padding: 12px 14px; border-radius: 14px; background: var(--pp-surface-2); margin: 10px 0; }
.mi-note .bi { color: var(--pp-ink); font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.mi-note b { color: var(--pp-text); }
.mi-source { font-size: .72rem; color: var(--pp-text-muted); margin-top: 6px; line-height: 1.4; }
.mi-empty { text-align: center; padding: 28px 10px; color: var(--pp-text-muted); font-size: .9rem; }
.mi-empty .bi { font-size: 2rem; display: block; margin: 0 auto 8px; color: var(--pp-ink); opacity: .8; }

/* ── Botones ── */
.mi-btn {
    min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--pp-border);
    background: var(--pp-surface); color: var(--pp-text); font-weight: 600; font-size: .95rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; -webkit-appearance: none;
    transition: transform .15s, background .15s;
}
.mi-btn:active { transform: scale(.97); }
.mi-btn.is-primary { background: var(--pp-btn); border-color: var(--pp-btn); color: var(--pp-on-btn); }
.mi-btn.is-navy { background: var(--pp-surface-2); border-color: var(--pp-border); color: var(--pp-text); }
.mi-btn.is-danger { color: var(--pp-danger); border-color: color-mix(in srgb, var(--pp-danger) 40%, transparent); }
.mi-btn.is-block { width: 100%; }
.mi-btn.is-sm { min-height: 38px; padding: 0 12px; font-size: .84rem; border-radius: 11px; }
.mi-btn[disabled], .mi-btn.is-busy { opacity: .55; pointer-events: none; cursor: default; }
.mi-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.mi-btns > .mi-btn { flex: 1; }
.mi-icon-btn { width: 40px; height: 40px; border-radius: 12px; border: none; background: transparent; color: var(--pp-text-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; cursor: pointer; }
.mi-icon-btn:active { background: var(--pp-surface-2); }

/* ── Formularios ── */
.mi-field { display: block; margin-bottom: 12px; }
.mi-label { display: block; font-size: .8rem; font-weight: 600; color: var(--pp-text-muted); margin: 0 0 6px 2px; }
.mi-input {
    width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 13px; border: 1px solid var(--pp-border);
    background: var(--pp-solid); color: var(--pp-text); font-size: 1rem; outline: none; -webkit-appearance: none; appearance: none;
}
.mi-input:focus { border-color: var(--pp-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pp-accent) 20%, transparent); }
textarea.mi-input { min-height: 80px; resize: vertical; }
select.mi-input { background-image: linear-gradient(45deg, transparent 50%, var(--pp-text-muted) 50%), linear-gradient(135deg, var(--pp-text-muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.mi-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mi-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.mi-big-input { font-size: 1.7rem; font-weight: 700; text-align: center; min-height: 64px; font-family: 'Roboto Condensed', Roboto, sans-serif; }

/* Chips */
.mi-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mi-chip {
    min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--pp-border);
    background: var(--pp-surface); color: var(--pp-text); font-size: .86rem; font-weight: 500; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
}
.mi-chip.on { background: color-mix(in srgb, var(--pp-accent) 18%, transparent); border-color: var(--pp-ink); color: var(--pp-text); font-weight: 700; }
.mi-chip .bi-x { font-size: .8rem; opacity: .7; }
.mi-seg { display: flex; background: var(--pp-surface-2); border-radius: 13px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.mi-seg button { flex: 1; min-height: 38px; border: none; border-radius: 10px; background: transparent; color: var(--pp-text-muted); font-weight: 600; font-size: .85rem; cursor: pointer; }
.mi-seg button.on { background: var(--pp-solid); color: var(--pp-text); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }

/* ── Inicio ── */
.mi-hello { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.mi-avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-family: 'Roboto Condensed', sans-serif; font-weight: 700; font-size: 1.4rem; background: var(--pp-surface-2); color: var(--pp-text); flex-shrink: 0; }
.mi-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.mi-stat { background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 16px; padding: 12px 10px; text-align: left; cursor: pointer; min-width: 0; box-shadow: var(--pp-shadow); }
.mi-stat .bi { color: var(--pp-ink); font-size: 1.05rem; }
.mi-stat-v { font-family: 'Roboto Condensed', sans-serif; font-weight: 700; font-size: 1.25rem; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-stat-u { font-size: .68rem; color: var(--pp-text-muted); }
.mi-stat-l { font-size: .72rem; color: var(--pp-text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mi-quick .mi-btn { min-height: 56px; justify-content: flex-start; padding: 0 14px; }
.mi-quick .mi-btn .bi { color: var(--pp-ink); font-size: 1.2rem; }

/* Dosis del día */
.mi-dose { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--pp-border); }
.mi-dose:first-child { border-top: none; padding-top: 2px; }
.mi-dose-time { font-family: 'Roboto Condensed', sans-serif; font-weight: 700; font-size: 1rem; min-width: 70px; }
.mi-dose.is-done .mi-dose-time, .mi-dose.is-done .mi-dose-name { opacity: .5; text-decoration: line-through; }
.mi-dose-name { font-weight: 600; font-size: .95rem; }
.mi-check { width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--pp-border); background: transparent; color: var(--pp-text-muted); display: grid; place-items: center; font-size: 1.2rem; cursor: pointer; flex-shrink: 0; }
.mi-check.on { background: var(--pp-success); border-color: var(--pp-success); color: var(--pp-on-success); }

/* Listas */
.mi-item { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--pp-surface); border: 1px solid var(--pp-border); margin-bottom: 10px; cursor: pointer; box-shadow: var(--pp-shadow); }
.mi-item-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--pp-accent) 16%, transparent); color: var(--pp-ink); font-size: 1.15rem; flex-shrink: 0; }
.mi-item-t { font-weight: 700; font-size: .98rem; }
.mi-item-s { font-size: .8rem; color: var(--pp-text-muted); margin-top: 2px; }
.mi-pill { font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--pp-surface-2); color: var(--pp-text-muted); white-space: nowrap; }
.mi-pill.on { background: color-mix(in srgb, var(--pp-success) 18%, transparent); color: var(--pp-success); }

/* Horarios de medicina */
.mi-times { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mi-time-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 12px; background: var(--pp-surface-2); border: 1px solid var(--pp-border); }
.mi-time-chip input { border: none; background: transparent; color: var(--pp-text); font-size: 1rem; width: 110px; min-height: 36px; outline: none; }

/* ── Tabla e historial ── */
.mi-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.mi-table th { text-align: left; font-size: .72rem; font-weight: 600; color: var(--pp-text-muted); padding: 6px 6px 8px; border-bottom: 1px solid var(--pp-border); }
.mi-table td { padding: 10px 6px; border-bottom: 1px solid var(--pp-border); vertical-align: middle; }
.mi-table td.num { font-family: 'Roboto Condensed', sans-serif; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.mi-table tr:last-child td { border-bottom: none; }
.mi-avg { display: flex; gap: 10px; margin-bottom: 12px; }
.mi-avg > div { flex: 1; background: var(--pp-surface-2); border-radius: 14px; padding: 10px 12px; }
.mi-avg-v { font-family: 'Roboto Condensed', sans-serif; font-size: 1.3rem; font-weight: 700; }
.mi-avg-l { font-size: .72rem; color: var(--pp-text-muted); }

/* Gráfica (SVG) */
.mi-chart { width: 100%; height: 170px; display: block; }
.mi-chart .ax { stroke: var(--pp-border); stroke-width: 1; }
.mi-chart .grid { stroke: var(--pp-border); stroke-width: 1; stroke-dasharray: 3 4; }
.mi-chart .lbl { fill: var(--pp-text-muted); font-size: 10px; font-family: Roboto, sans-serif; }
.mi-chart .l1 { stroke: var(--pp-accent); stroke-width: 2.4; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.mi-chart .l2 { stroke: var(--pp-line-2); stroke-width: 2.4; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.mi-chart .d1 { fill: var(--pp-accent); }
.mi-chart .d2 { fill: var(--pp-line-2); }
.mi-legend { display: flex; gap: 14px; font-size: .74rem; color: var(--pp-text-muted); margin-top: 6px; }
.mi-legend span::before { content: ''; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--pp-accent); }
.mi-legend span.s2::before { background: var(--pp-line-2); }

/* ── Medición guiada de tensión ── */
.mi-steps { display: flex; gap: 6px; margin-bottom: 16px; }
.mi-steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--pp-surface-2); }
.mi-steps i.on { background: var(--pp-accent); }
.mi-tips { margin: 0; padding: 0; list-style: none; }
.mi-tips li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; font-size: .92rem; line-height: 1.4; }
.mi-tips li .bi { color: var(--pp-ink); font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.mi-ring { width: 150px; height: 150px; margin: 10px auto 6px; position: relative; }
.mi-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mi-ring circle { fill: none; stroke-width: 10; }
.mi-ring .bg { stroke: var(--pp-surface-2); }
.mi-ring .fg { stroke: var(--pp-accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.mi-ring-n { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'Roboto Condensed', sans-serif; font-size: 2.4rem; font-weight: 700; }
.mi-result { text-align: center; padding: 6px 0 4px; }
.mi-result-v { font-family: 'Roboto Condensed', sans-serif; font-size: 2.8rem; font-weight: 700; line-height: 1; }
.mi-result-u { font-size: .9rem; color: var(--pp-text-muted); margin-top: 4px; }

/* ── Hoja inferior (modal propio, nunca alert/confirm) ── */
.mi-sheet-wrap { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: color-mix(in srgb, var(--pp-bg) 55%, transparent); animation: mi-fade .2s ease both; }
.mi-sheet {
    width: 100%; max-height: 92%; overflow-y: auto; background: color-mix(in srgb, var(--pp-solid) 90%, transparent); color: var(--pp-text);
    -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); border-top: 1px solid var(--pp-border);
    border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px));
    animation: mi-up .28s cubic-bezier(.2, .8, .2, 1) both;
}
.mi-sheet-grip { width: 40px; height: 5px; border-radius: 4px; background: var(--pp-border); margin: 4px auto 10px; }
.mi-sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.mi-sheet-head h3 { margin: 0; flex: 1; font-family: 'Roboto Condensed', sans-serif; font-size: 1.25rem; }
@keyframes mi-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mi-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Popover de información (ℹ︎) */
.mi-info { display: inline-flex; width: 28px; height: 28px; border: none; border-radius: 50%; background: transparent; color: var(--pp-text-muted); align-items: center; justify-content: center; cursor: pointer; font-size: .95rem; vertical-align: middle; }

/* ── Aviso flotante ── */
.mi-toast {
    position: absolute; left: 16px; right: 16px; margin: 0 auto; width: max-content; bottom: calc(var(--ppd-h) + 52px + env(safe-area-inset-bottom, 0px)); z-index: 40;
 background: var(--pp-text); color: var(--pp-bg); padding: 11px 18px; border-radius: 14px;
    font-size: .88rem; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: calc(100% - 40px); text-align: center;
    animation: mi-up .25s ease both;
}

/* Banner de instalar */
.mi-install { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; margin-bottom: 14px; background: var(--pp-surface); border: 1px solid var(--pp-border); color: var(--pp-text); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); }
.mi-install img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; flex-shrink: 0; }
.mi-install > div { min-width: 0; flex: 1; }
.mi-install b { display: block; font-size: .95rem; }
.mi-install span { font-size: .78rem; color: var(--pp-text-muted); }
.mi-install .mi-btn { min-height: 38px; padding: 0 14px; font-size: .85rem; flex-shrink: 0; }

/* ── Dock glossy (calcado del portal del paciente) ── */
.ppd-dock {
    position: absolute; z-index: 5; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    height: var(--ppd-h); max-width: 480px; margin: 0 auto; --ppd-item: var(--m-acc);
    --ppd-tint: color-mix(in srgb, var(--pp-dock-bar) 55%, transparent);
    --ppd-gloss: color-mix(in srgb, white 22%, transparent);
    --ppd-edge-top: color-mix(in srgb, white 45%, transparent);
    --ppd-edge: color-mix(in srgb, white 16%, transparent);
    --ppd-drop: color-mix(in srgb, black 35%, transparent);
}
html[data-pp-scheme="light"] .ppd-dock {
    --ppd-tint: color-mix(in srgb, var(--pp-dock-bar) 62%, transparent);
    --ppd-gloss: color-mix(in srgb, white 60%, transparent);
    --ppd-edge-top: color-mix(in srgb, white 90%, transparent);
    --ppd-edge: color-mix(in srgb, black 9%, transparent);
    --ppd-drop: color-mix(in srgb, black 16%, transparent);
}
.ppd-glass { position: absolute; inset: -40px 0 0 0; pointer-events: none; }
.ppd-bar, .ppd-bump { background: var(--ppd-tint); -webkit-backdrop-filter: blur(44px) saturate(180%); backdrop-filter: blur(44px) saturate(180%); }
.ppd-bar { position: absolute; left: 0; right: 0; bottom: 0; height: var(--ppd-h); border-radius: 24px; box-shadow: inset 0 1px 0 var(--ppd-edge-top), inset 0 0 0 1px var(--ppd-edge), 0 10px 30px var(--ppd-drop); }
.ppd-bump { position: absolute; bottom: calc(var(--ppd-h) - 42px); left: 0; width: 66px; height: 66px; border-radius: 50%; clip-path: inset(0 0 40px 0); box-shadow: inset 0 1px 0 var(--ppd-edge-top), inset 0 0 0 1px var(--ppd-edge); transform: translateX(var(--x, 0px)); transition: transform .55s cubic-bezier(.5, 1.6, .4, 1); }
.ppd-bar::before, .ppd-bump::before { content: ""; position: absolute; left: 0; right: 0; top: 0; border-radius: inherit; pointer-events: none; }
.ppd-bar::before { height: 50%; background: linear-gradient(180deg, var(--ppd-gloss), transparent); }
.ppd-bump::before { bottom: 0; background: var(--ppd-gloss); }
.ppd-orb {
    position: absolute; top: -22px; left: 0; width: 48px; height: 48px; border-radius: 16px; background: var(--ppd-item); color: var(--m-on);
    display: grid; place-items: center; transform: translateX(var(--xo, 0px)); pointer-events: none;
    transition: transform .55s cubic-bezier(.5, 1.6, .4, 1); box-shadow: 0 6px 22px color-mix(in srgb, var(--ppd-item) 55%, transparent);
}
.ppd-orb .bi { font-size: 23px; }
.ppd-items { position: absolute; inset: 0; display: flex; z-index: 2; }
.ppd-item { flex: 1; min-width: 0; border: 0; background: none; color: var(--pp-text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding: 0 0 4px; -webkit-appearance: none; }
.ppd-item .bi { font-size: 21px; transition: opacity .25s, transform .35s; }
.ppd-item .ppd-lbl { font-size: 9.5px; font-weight: 600; line-height: 1; white-space: nowrap; transition: opacity .2s; }
.ppd-item.on .bi { opacity: 0; transform: translateY(-10px); }
.ppd-item.on .ppd-lbl { opacity: 0; }
.ppd-noanim .ppd-bump, .ppd-noanim .ppd-orb { transition: none !important; }

html[data-pp-scheme="light"] .ppd-bar, html[data-pp-scheme="light"] .ppd-bump { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ppd-item:focus-visible { outline: 2px solid var(--m-acc); outline-offset: -6px; border-radius: 16px; }
.mi-btn:focus-visible, .mi-chip:focus-visible, .mi-input:focus-visible, .mi-icon-btn:focus-visible, .pp-tb-btn:focus-visible, .mi-check:focus-visible, .cm-acc .cm-hd:focus-visible { outline: 2px solid var(--m-acc); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .mi-view, .mi-sheet, .mi-sheet-wrap, .mi-toast { animation: none; }
    .ppd-bump, .ppd-orb, .mi-ring .fg { transition: none; }
}
@media (min-width: 560px) { #pp-card { border-left: 1px solid var(--pp-border); border-right: 1px solid var(--pp-border); } }

/* ── Foto (avatar) ── */
.mi-avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; flex-shrink: 0; }
.mi-avatar { border-radius: 50%; overflow: hidden; }
.mi-avatar.has-photo, .ct-photo.has-photo { background: var(--pp-surface-2); }
.mi-avatar img, .ct-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Mi ficha como tarjeta de contacto ── */
.ct-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 4px; }
.ct-photo {
    width: 120px; height: 120px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
    background: var(--pp-surface-2); color: var(--pp-text);
    font-family: 'Roboto Condensed', sans-serif; font-weight: 700; font-size: 3rem;
    box-shadow: 0 10px 30px color-mix(in srgb, var(--cima-navy) 28%, transparent), 0 0 0 4px var(--pp-solid);
}
.ct-photo .bi { font-size: 3.4rem; }
.ct-name { margin: 14px 0 2px; font-family: 'Roboto Condensed', Roboto, sans-serif; font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.ct-sub { color: var(--pp-text-muted); font-size: .92rem; }
.ct-actions { display: flex; justify-content: center; gap: 12px; margin: 18px 0 18px; }
.ct-act {
    flex: 1; max-width: 104px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 9px;
    border-radius: 16px; border: 1px solid var(--pp-border); background: var(--pp-surface); color: var(--pp-ink);
    font-size: .74rem; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: var(--pp-shadow);
}
.ct-act span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--pp-accent) 16%, transparent); font-size: 1.15rem; }
.ct-act:active { transform: scale(.96); }
.ct-act.is-busy { opacity: .55; pointer-events: none; }
.ct-group { background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 16px; margin-bottom: 12px; overflow: hidden; box-shadow: var(--pp-shadow); }
.ct-gtitle { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pp-text-muted); padding: 12px 16px 2px; }
.ct-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--pp-border); }
.ct-gtitle + .ct-row { border-top: 0; }
.ct-label { width: 100%; font-size: .74rem; color: var(--pp-text-muted); margin-bottom: -6px; }
.ct-label:empty { display: none; }
.ct-value { flex: 1; min-width: 0; font-size: .98rem; line-height: 1.4; }
.ct-chips { gap: 8px; padding-bottom: 14px; }
.ct-chips .mi-chip { cursor: default; min-height: 32px; }
.ct-alg { border-color: color-mix(in srgb, var(--pp-danger) 45%, transparent); background: color-mix(in srgb, var(--pp-danger) 10%, transparent); }
.ct-link { color: var(--pp-ink); font-weight: 600; text-decoration: none; }
.ct-mini { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--pp-accent) 16%, transparent); color: var(--pp-ink); text-decoration: none; flex-shrink: 0; }
.ct-head-edit .ct-photo { width: 112px; height: 112px; font-size: 2.6rem; }

/* ── Recorte de la foto ── */
.fc-stage { position: relative; margin: 0 auto 12px; border-radius: 16px; overflow: hidden; background: var(--pp-surface-2); touch-action: none; cursor: grab; }
.fc-stage canvas { display: block; width: 100%; height: 100%; }
.fc-frame { position: absolute; pointer-events: none; border: 2px solid var(--pp-accent); border-radius: 50%; box-sizing: border-box; }
.fc-zoom { display: flex; align-items: center; gap: 10px; color: var(--pp-text-muted); margin-bottom: 12px; }
.fc-zoom input { flex: 1; min-width: 0; accent-color: var(--pp-ink); }
.fc-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.fc-note { flex: 1; min-width: 140px; }
.fc-bgs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.fc-bg { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--pp-border); cursor: pointer; padding: 0; }
.fc-bg.on { border-color: var(--pp-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pp-accent) 30%, transparent); }
.ct-head-edit .mi-btns > .mi-btn { flex: 0 0 auto; white-space: nowrap; }

/* ── Acordeones planos (como Mi perfil de CIMA móvil: cima-mobile/app/movil/shell.css .cm-acc) ── */
.cm-h { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pp-text-muted); margin: 22px 4px 6px; }
.cm-list { background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 18px; padding: 2px 10px; box-shadow: var(--pp-shadow); }
.cm-acc + .cm-acc { border-top: 1px solid var(--pp-border); }
.cm-acc .cm-hd { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 4px; min-height: 58px; cursor: pointer; border: 0; background: none; color: var(--pp-text); text-align: left; border-radius: 12px; -webkit-appearance: none; }
.cm-acc .cm-hd:active { background: var(--pp-surface-2); }
.cm-acc .cm-hd > .bi:first-child { color: var(--pp-ink); font-size: 1.15rem; width: 26px; text-align: center; flex-shrink: 0; }
.cm-hd-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cm-hd-tx b { font-size: .96rem; font-weight: 600; }
.cm-hd-tx small { font-size: .8rem; color: var(--pp-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-acc .cm-chev { color: var(--pp-text-muted); transition: transform .2s ease; font-size: .9rem; flex-shrink: 0; }
.cm-acc.open .cm-chev { transform: rotate(90deg); }
.cm-acc .cm-bd { display: none; padding: 2px 4px 16px 42px; }
.cm-acc.open .cm-bd { display: block; animation: mi-in .18s ease both; }
.cm-acc.open .cm-hd-tx small { display: none; }
.ct-photo-btn { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.ct-photo-cam { position: absolute; right: 2px; bottom: 4px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pp-btn); color: var(--pp-on-btn); border: 3px solid var(--pp-bg); font-size: .9rem; }
.mi-toast-action { display: flex; align-items: center; gap: 12px; text-align: left; }
.mi-toast-action button { border: 0; border-radius: 10px; padding: 7px 12px; min-height: 36px; font-weight: 700; background: var(--pp-bg); color: var(--pp-ink); cursor: pointer; flex-shrink: 0; }

/* Inicio: tarjeta principal «Lleva tu salud a cualquier médico» y «+» en cada control */
.mi-hero { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; margin-bottom: 12px; background: var(--pp-surface); border: 1px solid var(--pp-border); box-shadow: var(--pp-shadow); }
.mi-hero-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--pp-accent) 16%, transparent); color: var(--pp-ink); font-size: 1.25rem; flex-shrink: 0; }
.mi-hero b { display: block; font-size: .98rem; }
.mi-hero span { display: block; font-size: .8rem; color: var(--pp-text-muted); margin-top: 2px; line-height: 1.35; }
.mi-stat .mi-row { justify-content: space-between; }
.mi-stat-add { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--pp-border); background: var(--pp-surface-2); color: var(--pp-ink); display: grid; place-items: center; font-size: .85rem; cursor: pointer; padding: 0; }

.mi-dist { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.mi-dist-row { display: grid; grid-template-columns: 118px 1fr 26px; align-items: center; gap: 8px; font-size: .8rem; }
.mi-dist-l { color: var(--pp-text-muted); white-space: nowrap; }
.mi-dist-bar { height: 10px; border-radius: 6px; background: var(--pp-surface-2); overflow: hidden; }
.mi-dist-bar i { display: block; height: 100%; border-radius: 6px; background: var(--pp-accent); }
.mi-dist-n { text-align: right; font-weight: 700; }
.mi-chip.on.ct-alg { border-color: color-mix(in srgb, var(--pp-danger) 50%, transparent); background: color-mix(in srgb, var(--pp-danger) 12%, transparent); }

/* Dibujo de la postura para medir la tensión */
.mi-postura { width: 100%; max-width: 340px; height: auto; display: block; margin: 0 auto 6px; }
.mi-postura .p-floor { stroke: var(--pp-border); stroke-width: 2; }
.mi-postura .p-furn { stroke: var(--pp-text-muted); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.mi-postura .p-body { stroke: var(--pp-text); stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mi-postura circle.p-body { fill: var(--pp-surface-2); stroke-width: 4; }
.mi-postura .p-cuff { stroke: var(--pp-accent); stroke-width: 13; stroke-linecap: round; }
.mi-postura .p-tube { stroke: var(--pp-accent); stroke-width: 2.4; fill: none; stroke-dasharray: 0; }
.mi-postura .p-mon { fill: var(--pp-surface-2); stroke: var(--pp-text-muted); stroke-width: 2.5; }
.mi-postura .p-mon-l { stroke: var(--pp-ink); stroke-width: 3; stroke-linecap: round; }
.mi-postura .p-guide { stroke: var(--pp-ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.mi-postura .p-heart { fill: var(--pp-danger); }
.mi-postura .p-lbl { fill: var(--pp-text-muted); font-size: 10.5px; font-family: Roboto, sans-serif; font-weight: 600; }

.mi-dist-t { font-size: .78rem; font-weight: 700; color: var(--pp-text-muted); margin: 14px 0 0; }
.mi-alert { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: .84rem; line-height: 1.4;
    background: color-mix(in srgb, var(--pp-warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--pp-warn) 40%, transparent); }
.mi-alert .bi { color: var(--pp-warn); font-size: 1.05rem; flex-shrink: 0; margin-top: 1px; }
.mi-dist-row { grid-template-columns: 96px 1fr 26px; }

.ct-meds { display: flex; flex-direction: column; gap: 8px; }
.ct-med { text-align: left; border: 1px solid var(--pp-border); background: var(--pp-surface-2); color: var(--pp-text); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.ct-med b { display: block; font-size: .92rem; }
.ct-med small { display: block; font-size: .78rem; color: var(--pp-text-muted); margin-top: 2px; }

/* ── Asistente de la primera vez ── */
.ob-wrap { position: absolute; inset: 0; z-index: 15; background: var(--pp-bg); display: flex; justify-content: center; animation: mi-fade .2s ease both; }
.ob-box { width: 100%; max-width: 520px; display: flex; flex-direction: column; height: 100%; }
.ob-head { display: flex; align-items: center; gap: 14px; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 6px; }
.ob-steps { flex: 1; margin: 0; }
.ob-skip { border: 0; background: none; color: var(--pp-ink); font-weight: 700; font-size: .92rem; padding: 10px 6px; cursor: pointer; }
.ob-body { flex: 1; overflow-y: auto; padding: 12px 18px 18px; }
.ob-title { font-family: 'Roboto Condensed', Roboto, sans-serif; font-size: 1.6rem; line-height: 1.15; margin: 6px 0 6px; }
.ob-foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--pp-border); background: var(--pp-bg); }
.ob-foot .mi-btn { min-width: 120px; }
.ob-med { background: var(--pp-surface); border: 1px solid var(--pp-border); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.ob-body .ct-head .mi-btns > .mi-btn { flex: 0 0 auto; white-space: nowrap; }

/* Esqueleto de carga de Inicio */
.sk { background: var(--pp-surface-2); border-radius: 14px; position: relative; overflow: hidden; }
.sk::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--pp-text) 7%, transparent), transparent); animation: sk-shine 1.2s ease-in-out infinite; }
@keyframes sk-shine { to { transform: translateX(100%); } }
.sk-brand { width: 132px; height: 30px; border-radius: 8px; }
.sk-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sk-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-av { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-line.sk-lg { height: 22px; }
.sk-box { height: 96px; border-radius: 18px; margin-bottom: 12px; }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sk-dock { position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); height: var(--ppd-h); border-radius: 24px; max-width: 480px; margin: 0 auto; }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }
.cm-bd .mi-btns > .mi-btn.is-sm { white-space: nowrap; }

/* Contraseña (mismo comportamiento que CIMA: invite_register.js + security.js) */
.pw-wrap { position: relative; }
.pw-wrap .mi-input { padding-right: 50px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: var(--pp-text-muted); border-radius: 10px; cursor: pointer; font-size: 1.05rem; }
.pw-eye:active { background: var(--pp-surface-2); }
.pw-bar { height: 5px; border-radius: 4px; background: color-mix(in srgb, var(--pp-text-muted) 22%, transparent); margin-top: 8px; overflow: hidden; }
.pw-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--pp-accent); transition: width .2s ease; }
.pw-rules { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.pw-rules li { font-size: .8rem; color: var(--pp-text-muted); display: flex; gap: 6px; align-items: center; }
.pw-rules li.is-ok { color: var(--pp-success); }
.pw-hint { display: block; font-size: .78rem; color: var(--pp-text-muted); margin-top: 6px; min-height: 1em; }
.pw-hint.is-ok { color: var(--pp-success); }
.pw-hint.is-bad { color: var(--pp-danger); }
.acc-ts { margin: 4px 0 12px; min-height: 0; }
