/**
 * MyHorsePro · Guía de estilo en código (fase 1 del rediseño).
 *
 * Tokens (variables) y componentes reutilizables `hp-*`. Las pantallas se irán pasando a estas piezas
 * en las fases siguientes; mientras, conviven con las clases de Tailwind que ya había.
 * Página de referencia con todos los componentes: /app/guia-estilo.html
 *
 * Reglas rápidas:
 * - Letra: 6 tamaños (meta 14 · cuerpo 16 · destacado 18 · título 22 · página 26 · cifra 32). En tablet
 *   suben 1-4 px solos. Nada por debajo de 14 px. Peso: texto 500, datos 600, nombres 700, títulos 800,
 *   solo cifras 900.
 * - Tacto: nada pulsable por debajo de 48 px; acción de campo 56 px; con guantes (Hecho, DADA) 64 px;
 *   montando 72 px. 12 px como mínimo entre la acción principal y una que borra o deshace.
 * - Un estado siempre con color + icono + palabra.
 * - Un solo botón principal por pantalla.
 */

:root {
    /* Color (mismos valores que tailwind.config.js) */
    --hp-cuero-50: #FDF8F5;
    --hp-cuero-100: #F7EDE6;
    --hp-cuero-200: #EFE0D4;
    --hp-cuero-600: #7B3F21;
    --hp-cuero-700: #64321A;
    --hp-cuero-900: #2A1308;
    --hp-bg: #FAF7F2;
    --hp-card: #FFFFFF;
    --hp-muted: #F0E7DC;
    --hp-line: #E8DFD3;
    --hp-line-strong: #D6C8B8;
    --hp-text: #1C1816;
    --hp-text-2: #4A3B32;
    --hp-ok: #1E632C;
    --hp-ok-bg: #EDF7EE;
    --hp-ok-line: #BFE4C4;
    --hp-warn: #A75D03;
    --hp-warn-bg: #FEF6E8;
    --hp-warn-line: #FADAA7;
    --hp-bad: #B52818;
    --hp-bad-bg: #FDF0EE;
    --hp-bad-line: #F8C2BC;

    /* Letra */
    --hp-font: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    --hp-font-num: 'Montserrat', 'Plus Jakarta Sans', system-ui, sans-serif;
    --hp-fs-meta: 0.875rem;   /* 14 */
    --hp-fs-body: 1rem;       /* 16 */
    --hp-fs-strong: 1.125rem; /* 18 */
    --hp-fs-title: 1.375rem;  /* 22 */
    --hp-fs-h1: 1.625rem;     /* 26 */
    --hp-fs-fig: 2rem;        /* 32 */

    /* Tacto */
    --hp-tap: 3rem;       /* 48 mínimo */
    --hp-tap-lg: 3.5rem;  /* 56 acción */
    --hp-tap-xl: 4rem;    /* 64 con guantes */
    --hp-tap-hud: 4.5rem; /* 72 montando */

    /* Forma */
    --hp-r-ctl: 0.75rem;  /* botones y campos */
    --hp-r-card: 1rem;    /* tarjetas y filas */
    --hp-r-sheet: 1.5rem; /* cajones */
    --hp-sh-card: 0 1px 2px rgba(42, 19, 8, 0.05), 0 4px 14px -6px rgba(42, 19, 8, 0.10);
    --hp-sh-float: 0 10px 24px -8px rgba(42, 19, 8, 0.45);
}

@media (min-width: 768px) {
    :root {
        --hp-fs-meta: 0.9375rem;  /* 15 */
        --hp-fs-body: 1.0625rem;  /* 17 */
        --hp-fs-strong: 1.1875rem;/* 19 */
        --hp-fs-title: 1.5rem;    /* 24 */
        --hp-fs-h1: 1.875rem;     /* 30 */
        --hp-fs-fig: 2.25rem;     /* 36 */
    }
}

/* ---------- Texto ---------- */
.hp-t-meta { font-size: var(--hp-fs-meta); font-weight: 600; line-height: 1.35; color: var(--hp-text-2); }
.hp-t-body { font-size: var(--hp-fs-body); font-weight: 500; line-height: 1.45; }
.hp-t-strong { font-size: var(--hp-fs-strong); font-weight: 700; line-height: 1.3; }
.hp-t-title { font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; line-height: 1.2; }
.hp-t-h1 { font-family: var(--hp-font-num); font-size: var(--hp-fs-h1); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.hp-t-fig { font-family: var(--hp-font-num); font-size: var(--hp-fs-fig); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.hp-label { display: block; font-size: var(--hp-fs-meta); font-weight: 700; color: var(--hp-text-2); margin-bottom: 0.375rem; }

/* ---------- Iconos (js/core/icons.js) ---------- */
.hp-i {
    width: 1.5rem;
    height: 1.5rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
}
.hp-i--sm { width: 1.125rem; height: 1.125rem; }
.hp-i--lg { width: 1.75rem; height: 1.75rem; }

/* ---------- Botón ---------- */
.hp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--hp-tap);
    padding: 0 1rem;
    border-radius: var(--hp-r-ctl);
    border: 2px solid transparent;
    font-family: var(--hp-font);
    font-size: var(--hp-fs-body);
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s ease-out, background-color 0.15s, border-color 0.15s;
}
.hp-btn:active { transform: scale(0.97); }
.hp-btn:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-btn:disabled, .hp-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.hp-btn--primary { background: var(--hp-cuero-600); color: #fff; border-bottom-color: var(--hp-cuero-900); }
.hp-btn--primary:hover { background: var(--hp-cuero-700); }
.hp-btn--secondary { background: var(--hp-card); color: var(--hp-text); border-color: var(--hp-line-strong); }
.hp-btn--secondary:hover { background: var(--hp-cuero-50); }
.hp-btn--ok { background: var(--hp-ok); color: #fff; }
.hp-btn--ok-line { background: var(--hp-card); color: var(--hp-ok); border-color: var(--hp-ok); }
.hp-btn--danger { background: var(--hp-card); color: var(--hp-bad); border-color: var(--hp-bad-line); }
.hp-btn--danger-solid { background: var(--hp-bad); color: #fff; }
.hp-btn--ghost { background: transparent; color: var(--hp-text); }
.hp-btn--ghost:hover { background: var(--hp-muted); }
.hp-btn--lg { min-height: var(--hp-tap-lg); font-size: var(--hp-fs-strong); }
.hp-btn--xl { min-height: var(--hp-tap-xl); font-size: var(--hp-fs-strong); padding: 0 1.25rem; }
.hp-btn--hud { min-height: var(--hp-tap-hud); font-size: var(--hp-fs-title); padding: 0 1.5rem; }
.hp-btn--block { display: flex; width: 100%; }
.hp-btn--icon { width: var(--hp-tap); padding: 0; }
.hp-btn--icon.hp-btn--lg { width: var(--hp-tap-lg); }
.hp-btn--stack { flex-direction: column; gap: 0.25rem; min-height: 4.5rem; font-size: var(--hp-fs-meta); padding: 0 0.375rem; }

/* Botón flotante («Apuntar») por encima de la barra inferior */
.hp-fab {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: calc(6rem + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
    z-index: 25;
    border-radius: 999px;
    padding: 0 1.375rem;
    box-shadow: var(--hp-sh-float);
}

/* ---------- Tarjeta ---------- */
.hp-card {
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
    padding: 1rem;
    box-shadow: var(--hp-sh-card);
}
@media (min-width: 768px) { .hp-card { padding: 1.25rem; } }
.hp-card--flat { box-shadow: none; }
.hp-card--warn { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); box-shadow: none; }
.hp-card--danger { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); box-shadow: none; }
.hp-card--tap { display: block; width: 100%; text-align: left; cursor: pointer; }
.hp-card--tap:active { transform: scale(0.99); }

/* ---------- Fila de lista (caballo, toma, aviso, cobro) ---------- */
.hp-list { display: flex; flex-direction: column; gap: 0.5rem; }
.hp-list--2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.625rem; }
@media (min-width: 768px) { .hp-list--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.hp-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.75rem;
    padding: 0.625rem 0.625rem 0.625rem 0.75rem;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
    box-shadow: var(--hp-sh-card);
}
.hp-row--compact { min-height: 3.75rem; gap: 0.5rem; }
.hp-row-main {
    flex: 1;
    min-width: 0;
    min-height: var(--hp-tap-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.25rem 0;
    background: none;
    border: 0;
    color: inherit;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.hp-row-title { font-size: var(--hp-fs-strong); font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-row-sub { display: flex; align-items: center; gap: 0.375rem; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-row.is-done { background: transparent; box-shadow: none; border-style: dashed; }
.hp-row.is-done .hp-row-title { color: var(--hp-text-2); }
.hp-row.is-selected { border-color: var(--hp-cuero-600); box-shadow: inset 0 0 0 2px var(--hp-cuero-600); }

/* Cabecera plegable de un grupo («Hechos (12)») */
.hp-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: var(--hp-tap);
    padding: 0 0.25rem;
    background: none;
    border: 0;
    font: inherit;
    font-size: var(--hp-fs-meta);
    font-weight: 800;
    color: var(--hp-text-2);
    cursor: pointer;
}
.hp-group[aria-expanded="true"] .hp-i { transform: rotate(90deg); }

/* ---------- Box y chips ---------- */
.hp-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    min-width: 3rem;
    height: 3rem;
    padding: 0 0.375rem;
    border-radius: var(--hp-r-ctl);
    background: var(--hp-cuero-100);
    border: 1px solid var(--hp-cuero-200);
    color: var(--hp-cuero-700);
    font-family: var(--hp-font-num);
    font-size: 1.125rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.hp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 1.875rem;
    padding: 0 0.625rem;
    border-radius: 999px;
    border: 1px solid var(--hp-line);
    background: var(--hp-muted);
    color: var(--hp-text-2);
    font-size: var(--hp-fs-meta);
    font-weight: 700;
    white-space: nowrap;
}
.hp-chip .hp-i { width: 1rem; height: 1rem; }
.hp-chip--ok { background: var(--hp-ok-bg); border-color: var(--hp-ok-line); color: var(--hp-ok); }
.hp-chip--warn { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); color: var(--hp-warn); }
.hp-chip--bad { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); color: var(--hp-bad); }

/* Filtros en píldora (pulsables) */
.hp-filter { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; padding: 0.125rem 0; }
.hp-filter::-webkit-scrollbar { display: none; }
.hp-filter > button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex: none;
    min-height: 3rem;
    padding: 0 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--hp-line-strong);
    background: var(--hp-card);
    color: var(--hp-text);
    font: inherit;
    font-size: var(--hp-fs-meta);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.hp-filter > button[aria-pressed="true"] { background: var(--hp-text); border-color: var(--hp-text); color: #fff; }
.hp-filter .hp-n { font-family: var(--hp-font-num); font-weight: 800; }

/* ---------- Selector segmentado (sustituye a <select> de 7 opciones o menos) ---------- */
.hp-seg {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 0.875rem;
    background: var(--hp-muted);
}
.hp-seg > button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.0625rem;
    min-height: 3.25rem;
    padding: 0 0.25rem;
    border: 0;
    border-radius: 0.625rem;
    background: transparent;
    color: var(--hp-text-2);
    font: inherit;
    font-size: var(--hp-fs-meta);
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
}
.hp-seg > button small { font-size: 0.8125rem; font-weight: 600; opacity: 0.9; }
.hp-seg > button[aria-pressed="true"],
.hp-seg > button.is-active { background: var(--hp-card); color: var(--hp-cuero-700); box-shadow: var(--hp-sh-card); }
.hp-seg > button:focus-visible,
.hp-filter > button:focus-visible,
.hp-row-main:focus-visible,
.hp-group:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }

/* ---------- Contadores (pueden filtrar la lista) ---------- */
.hp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.hp-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-height: 4.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
    text-align: left;
    font: inherit;
    color: inherit;
}
button.hp-stat { cursor: pointer; }
.hp-stat b { font-family: var(--hp-font-num); font-size: var(--hp-fs-fig); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.hp-stat span { font-size: var(--hp-fs-meta); font-weight: 700; color: var(--hp-text-2); }
.hp-stat[aria-pressed="true"] { border-color: var(--hp-cuero-600); box-shadow: inset 0 0 0 2px var(--hp-cuero-600); }

/* ---------- Aviso de una línea (stock bajo, sin conexión…) ---------- */
.hp-banner {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 3.25rem;
    padding: 0 0.75rem;
    border-radius: var(--hp-r-ctl);
    border: 1px solid var(--hp-warn-line);
    background: var(--hp-warn-bg);
    color: var(--hp-warn);
    font: inherit;
    font-size: var(--hp-fs-meta);
    font-weight: 700;
    text-align: left;
}
.hp-banner > span { flex: 1; min-width: 0; color: var(--hp-text); }
.hp-banner--bad { border-color: var(--hp-bad-line); background: var(--hp-bad-bg); color: var(--hp-bad); }
.hp-banner--ok { border-color: var(--hp-ok-line); background: var(--hp-ok-bg); color: var(--hp-ok); }
button.hp-banner { cursor: pointer; }

/* ---------- Cabecera de pantalla (fija arriba) ---------- */
.hp-pagehead {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.625rem 0 0.75rem;
    background: var(--hp-bg);
}
.hp-pagehead-row { display: flex; align-items: center; gap: 0.5rem; min-height: var(--hp-tap); }
.hp-pagehead-row > .hp-t-h1 { margin: 0; }
.hp-pagehead-aside { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; min-width: 0; }

/* Barra de progreso fina */
.hp-progress { display: flex; align-items: center; gap: 0.625rem; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); }
.hp-progress-bar { flex: 1; height: 0.5rem; border-radius: 99px; background: var(--hp-muted); overflow: hidden; }
.hp-progress-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--hp-ok); transition: width 0.3s; }

/* ---------- Campo de formulario ---------- */
.hp-input {
    display: block;
    width: 100%;
    min-height: var(--hp-tap);
    padding: 0 0.875rem;
    border-radius: var(--hp-r-ctl);
    border: 2px solid var(--hp-line-strong);
    background: var(--hp-card);
    color: var(--hp-text);
    font-family: var(--hp-font);
    font-size: max(16px, var(--hp-fs-body)); /* 16 px como mínimo: iOS no hace zoom al escribir */
    font-weight: 600;
}
textarea.hp-input { padding: 0.75rem 0.875rem; min-height: 6rem; line-height: 1.45; }
.hp-input:focus { outline: none; border-color: var(--hp-cuero-600); box-shadow: 0 0 0 3px var(--hp-cuero-200); }
.hp-input::placeholder { color: #6B5A4E; font-weight: 500; }

/* Interruptor (sustituye a casillas de 24 px) */
.hp-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--hp-tap-lg);
    font-size: var(--hp-fs-body);
    font-weight: 600;
    cursor: pointer;
}
.hp-toggle input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 3.25rem; height: 2rem; border-radius: 99px; background: var(--hp-line-strong); cursor: pointer; transition: background 0.15s; margin: 0; }
.hp-toggle input::after { content: ''; position: absolute; top: 0.25rem; left: 0.25rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.hp-toggle input:checked { background: var(--hp-ok); }
.hp-toggle input:checked::after { transform: translateX(1.25rem); }
.hp-toggle input:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }

/* Pares dato: valor (ficha) */
.hp-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; margin: 0; font-size: var(--hp-fs-body); }
.hp-kv dt { color: var(--hp-text-2); font-weight: 600; }
.hp-kv dd { margin: 0; font-weight: 700; min-width: 0; }

/* Menú de acciones (⋯) dentro de un cajón */
.hp-menu { display: flex; flex-direction: column; }
.hp-menu > button,
.hp-menu > a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--hp-tap-lg);
    padding: 0 0.25rem;
    border: 0;
    border-bottom: 1px solid var(--hp-line);
    background: none;
    color: var(--hp-text);
    font: inherit;
    font-size: var(--hp-fs-body);
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.hp-menu > :last-child { border-bottom: 0; }
.hp-menu > .is-danger { color: var(--hp-bad); }

/* Estado vacío: icono, una frase y un botón */
.hp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--hp-text-2);
    font-size: var(--hp-fs-body);
    font-weight: 600;
}
.hp-empty > .hp-i { width: 2.5rem; height: 2.5rem; color: var(--hp-cuero-600); }

@media (prefers-reduced-motion: reduce) {
    .hp-btn, .hp-progress-bar > i, .hp-toggle input, .hp-toggle input::after { transition: none; }
    .hp-btn:active, .hp-card--tap:active { transform: none; }
}

/* ---------- Selector táctil (js/core/picker.js): sustituye a los desplegables nativos ---------- */
.hp-picker-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; }
.hp-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: var(--hp-tap-lg);
    padding: 0 0.875rem;
    border-radius: var(--hp-r-ctl);
    border: 2px solid var(--hp-line-strong);
    background: var(--hp-card);
    color: var(--hp-text);
    font-family: var(--hp-font);
    font-size: var(--hp-fs-body);
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.hp-picker-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.hp-picker-btn:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-picker-btn-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hp-picker { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.hp-picker.is-open { pointer-events: auto; }
.hp-picker-scrim { position: absolute; inset: 0; background: rgba(28, 24, 22, 0.5); opacity: 0; transition: opacity 0.2s; }
.hp-picker.is-open .hp-picker-scrim { opacity: 1; }
.hp-picker-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: calc(100dvh - var(--safe-area-inset-top, env(safe-area-inset-top)) - 3rem);
    margin: 0 auto;
    max-width: 36rem;
    display: flex;
    flex-direction: column;
    background: var(--hp-card);
    border-radius: var(--hp-r-sheet) var(--hp-r-sheet) 0 0;
    box-shadow: 0 -10px 40px rgba(42, 19, 8, 0.22);
    padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom));
    transform: translateY(105%);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    outline: none;
}
.hp-picker.is-open .hp-picker-panel { transform: none; }
.hp-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1rem 0.75rem; border-bottom: 1px solid var(--hp-line); }
.hp-picker-head h3 { margin: 0; }
.hp-picker-search { position: relative; padding: 0.75rem 1rem 0.25rem; }
.hp-picker-search[hidden] { display: none; }
.hp-picker-search .hp-input { padding-left: 2.75rem; }
.hp-picker-search-ico { position: absolute; left: 1.875rem; top: 50%; transform: translateY(-35%); color: var(--hp-text-2); pointer-events: none; }
.hp-picker-list { overflow-y: auto; overscroll-behavior: contain; padding: 0.5rem 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.hp-picker-group { margin: 0.75rem 0.25rem 0.25rem; font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-text-2); }
.hp-picker-opt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--hp-tap-lg);
    padding: 0.375rem 0.5rem;
    border: 0;
    border-radius: var(--hp-r-ctl);
    background: none;
    color: var(--hp-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.hp-picker-opt:hover { background: var(--hp-cuero-50); }
.hp-picker-opt.is-on { background: var(--hp-cuero-100); }
.hp-picker-opt:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: -3px; }
.hp-picker-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-picker-check { color: var(--hp-cuero-700); }
html.hp-picker-lock { overflow: hidden; }
@media (min-width: 768px) {
    .hp-picker-panel { top: 50%; bottom: auto; border-radius: var(--hp-r-sheet); transform: translateY(-40%) scale(0.98); opacity: 0; max-height: min(80dvh, 44rem); transition: transform 0.2s, opacity 0.2s; }
    .hp-picker.is-open .hp-picker-panel { transform: translateY(-50%); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .hp-picker-scrim, .hp-picker-panel { transition: none; }
}

/* ==========================================================================
   Pantalla Hoy (#tab-hoy, js/views/plan.js)
   ========================================================================== */
#tab-hoy .hp-pagehead {
    /* Pegada bajo la barra superior (4,25 rem en móvil, 4,75 rem en tablet; en ordenador no hay barra) */
    top: calc(4.25rem + var(--safe-area-inset-top, env(safe-area-inset-top)));
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
}
@media (min-width: 768px) {
    #tab-hoy .hp-pagehead { top: calc(4.75rem + var(--safe-area-inset-top, env(safe-area-inset-top))); margin-inline: -1.5rem; padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
    #tab-hoy .hp-pagehead { top: 0; }
}
.hoy-date { display: flex; align-items: center; gap: 0.125rem; min-width: 0; }
.hoy-date > strong { min-width: 5.5rem; text-align: center; font-size: var(--hp-fs-strong); font-weight: 700; white-space: nowrap; }
.hoy-date .hp-btn { width: 3rem; min-height: 3rem; padding: 0; }
.hoy-stats-wrap { display: none; }
@media (min-width: 768px) {
    .hoy-stats-wrap { display: block; }
    .hoy-progress-wrap { display: none; }
}
#tab-hoy .hp-stat { min-height: 4.25rem; }
#tab-hoy .hp-stat b { font-size: 1.75rem; }

/* Botón «Apuntar»: flotante en el móvil; en la cabecera desde tablet (un solo botón, data-action="quick-log") */
@media (min-width: 768px) {
    #tab-hoy .hp-fab {
        position: static;
        border-radius: var(--hp-r-ctl);
        box-shadow: none;
        min-height: var(--hp-tap-lg);
        padding: 0 1.25rem;
    }
}
.hp-hoy-plan { display: none; }
@media (min-width: 768px) { .hp-hoy-plan { display: inline-flex; } }
.hp-hoy-plan[hidden] { display: none !important; }

.hoy-list { gap: 0.75rem; }
.hoy-list.hp-list--2 { gap: 0.75rem; }
.hoy-list-wrap { padding-bottom: 6.5rem; }
@media (min-width: 768px) { .hoy-list-wrap { padding-bottom: 1.5rem; } }
.hoy-list .hp-row.is-busy { opacity: 0.6; pointer-events: none; }
.hoy-done-btn { min-width: 6.75rem; flex: none; }
.hoy-done-btn.hp-btn--ghost { color: var(--hp-ok); }
.hoy-row-flag { color: var(--hp-bad); }

/* Avisos de la cuadra, compactos */
.hoy-alerts { display: flex; flex-direction: column; gap: 0.5rem; }
.hoy-alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-text-2); }
.hoy-alert { padding: 0.25rem 0.375rem 0.25rem 0.75rem; }
.hoy-alert > div { flex: 1; min-width: 0; }
.hoy-alert b { display: block; font-size: var(--hp-fs-body); font-weight: 700; color: var(--hp-text); line-height: 1.25; }
.hoy-alert small { display: block; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); line-height: 1.3; }
.hoy-alert--info { border-color: var(--hp-line-strong); background: var(--hp-card); color: var(--hp-text-2); }

/* Cajón del caballo */
/* Cabecera de todos los cajones: título (hasta 2 líneas) a la izquierda y botón de cerrar a la derecha */
.hoy-sheet-head { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--hp-line); }
.hoy-sheet-head > div { flex: 1; min-width: 0; }
.hoy-sheet-head > .hp-btn { flex: none; }
.hoy-sheet-name { margin: 0; font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.hoy-sheet-body { display: flex; flex-direction: column; gap: 1.25rem; }
.hoy-seg { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr)); }
.hoy-sheet-foot { flex: none; display: grid; grid-template-columns: 1fr 1.5fr; gap: 0.75rem; padding: 0.75rem var(--hp-pad) var(--hp-pad); border-top: 1px solid var(--hp-line); background: var(--hp-card); }

/* ---------- Etiqueta pequeña encima de un nombre («BOX 01», «PADDOCK A») ---------- */
.hp-eyebrow {
    display: block;
    font-size: var(--hp-fs-meta);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hp-cuero-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Ficha de box (Cuadra): box y ⋯ arriba, nombre, ración completa y botones abajo a lo ancho ---------- */
.hp-boxcards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; align-items: stretch; }
@media (min-width: 640px) { .hp-boxcards { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); } }
.hp-boxcard {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.875rem 0.875rem;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
    box-shadow: var(--hp-sh-card);
}
.hp-boxcard-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 1.75rem; }
.hp-boxcard-more {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin: -0.75rem -0.625rem -0.75rem 0; /* área de 48 px sin agrandar la ficha */
    border: 0;
    border-radius: var(--hp-r-ctl);
    background: none;
    color: var(--hp-text-2);
    cursor: pointer;
}
.hp-boxcard-more:hover { background: var(--hp-muted); }
.hp-boxcard-name {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--hp-text);
    font-family: var(--hp-font);
    font-size: var(--hp-fs-strong);
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.hp-boxcard-ration { list-style: none; margin: 0.125rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-boxcard-ration li { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: 0.5rem; font-size: var(--hp-fs-meta); line-height: 1.35; color: var(--hp-text-2); }
.hp-boxcard-ration b { font-weight: 800; color: var(--hp-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hp-boxcard-ration span { font-weight: 500; overflow-wrap: anywhere; }
.hp-boxcard-none { margin: 0; display: flex; align-items: center; gap: 0.375rem; font-size: var(--hp-fs-meta); font-weight: 500; font-style: italic; color: var(--hp-text-2); }
/* Botones abajo: «No comió» (1 parte) y «Dada» (2 partes), con 12 px entre ellos */
.hp-boxcard-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 0.75rem; margin-top: auto; padding-top: 0.625rem; }
.hp-boxcard-actions .hp-btn { width: 100%; padding: 0 0.5rem; white-space: nowrap; }
.hp-boxcard-refuse { font-size: var(--hp-fs-meta); gap: 0.375rem; }
.hp-boxcard-refuse .hp-i { width: 1.125rem; height: 1.125rem; color: var(--hp-bad); }
/* Ya dada / no comió: sin botones, una línea con el estado */
.hp-boxcard-status { margin: 0.25rem 0 0; display: flex; align-items: center; gap: 0.375rem; font-size: var(--hp-fs-body); font-weight: 700; }
.hp-boxcard-status.is-ok { color: var(--hp-ok); }
.hp-boxcard-status.is-bad { color: var(--hp-bad); }
.hp-boxcard-name:focus-visible,
.hp-boxcard-more:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-boxcard.is-done { background: transparent; box-shadow: none; border-style: dashed; }
.hp-boxcard.is-done .hp-boxcard-name { color: var(--hp-text-2); }
.hp-boxcard.is-refused { border-color: var(--hp-bad-line); border-style: solid; background: var(--hp-bad-bg); }

/* ---------- Pantalla Montar ---------- */
.hp-chip--cuero { background: var(--hp-cuero-100); border-color: var(--hp-cuero-200); color: var(--hp-cuero-700); }
.hp-chip.is-pulse .hp-i { animation: hp-ride-pulse 1.2s ease-in-out infinite; }
@keyframes hp-ride-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .hp-chip.is-pulse .hp-i { animation: none; } }

/* Preparación: caballo, terreno y empezar */
.hp-ride-setup { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 768px) {
    .hp-ride-setup {
        max-width: 40rem;
        margin: 0.5rem auto 0;
        padding: 1.25rem;
        gap: 1.25rem;
        background: var(--hp-card);
        border: 1px solid var(--hp-line);
        border-radius: var(--hp-r-card);
        box-shadow: var(--hp-sh-card);
    }
}
.hp-ridepick {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 4.5rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--hp-line-strong);
    border-radius: var(--hp-r-card);
    background: var(--hp-card);
    color: var(--hp-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.hp-ridepick:active { background: var(--hp-cuero-50); }
.hp-ridepick:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-ridepick-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-ridepick > .hp-i { color: var(--hp-text-2); }
.hp-ride-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 3rem;
    height: 3rem;
    border-radius: var(--hp-r-ctl);
    background: var(--hp-cuero-100);
    border: 1px solid var(--hp-cuero-200);
    color: var(--hp-cuero-700);
    font-family: var(--hp-font-num);
    font-size: 1.375rem;
    font-weight: 800;
    overflow: hidden;
}
.hp-ride-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hp-ride-terrain > button { min-height: 4.25rem; gap: 0.25rem; font-size: var(--hp-fs-body); }
.hp-ride-terrain > button.is-active { box-shadow: inset 0 0 0 2px var(--hp-cuero-600), var(--hp-sh-card); }
.hp-ride-keep { margin: 0; display: flex; justify-content: center; align-items: flex-start; gap: 0.375rem; text-align: center; }
.hp-ride-keep .hp-i { flex: none; margin-top: 0.15em; }

/* Monta en curso */
.hp-ride-hud { display: flex; flex-direction: column; gap: 0.75rem; }
.hp-ride-who { display: flex; align-items: center; gap: 0.75rem; }
.hp-ride-who-txt { flex: 1; min-width: 0; }
.hp-ride-who-txt > * { margin: 0; }
.hp-ride-board { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 768px) {
    .hp-ride-board { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: stretch; gap: 1rem; }
    .hp-ride-data { justify-content: center; }
}
.hp-ride-clock {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
    box-shadow: var(--hp-sh-card);
    text-align: center;
}
.hp-ride-clock .hp-eyebrow { color: var(--hp-text-2); }
.hp-ride-timer {
    margin: 0;
    font-family: var(--hp-font-num);
    font-size: clamp(2.75rem, 15vw, 5rem);
    font-size: clamp(2.5rem, 17cqw, 6.5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--hp-text);
}
.hp-ride-gait { min-height: 3rem; padding: 0 1rem; gap: 0.625rem; font-size: var(--hp-fs-strong); font-weight: 800; }
.hp-ride-swatch { display: inline-block; flex: none; width: 0.875rem; height: 0.875rem; border-radius: 50%; background: var(--hp-line-strong); }
.hp-ride-swatch.is-walk { background: var(--hp-ok); }
.hp-ride-swatch.is-trot { background: #D98A0B; }
.hp-ride-swatch.is-canter { background: var(--hp-cuero-600); }
.hp-ride-swatch.is-halt { background: #A89A8C; }
.hp-ride-data { display: flex; flex-direction: column; gap: 0.75rem; }
.hp-ride-data .hp-stat { min-height: 5rem; padding: 0.625rem 0.625rem; }
.hp-ride-data .hp-stat em { font-style: normal; }
.hp-ride-data .hp-stat small { display: block; font-size: inherit; font-weight: 600; }
.hp-ride-bar { display: flex; height: 0.875rem; overflow: hidden; border-radius: 99px; background: var(--hp-muted); border: 1px solid var(--hp-line); }
.hp-ride-bar > div { height: 100%; }
.hp-ride-bar .is-walk { background: var(--hp-ok); }
.hp-ride-bar .is-trot { background: #D98A0B; }
.hp-ride-bar .is-canter { background: var(--hp-cuero-600); }
.hp-ride-bar .is-halt { background: #A89A8C; }
.hp-ride-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.75rem; margin-top: 0.5rem; font-size: var(--hp-fs-meta); font-weight: 700; color: var(--hp-text-2); }
.hp-ride-legend > span { display: inline-flex; align-items: center; gap: 0.375rem; min-width: 0; white-space: nowrap; }
.hp-ride-notebox { display: flex; flex-direction: column; gap: 0.5rem; }
.hp-ride-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.hp-ride-discard { min-height: var(--hp-tap); color: var(--hp-bad); font-size: var(--hp-fs-meta); }
.hp-ride-discard:hover { background: var(--hp-bad-bg); }


/* ---------- Pantalla Caballos ---------- */
#tab-caballos [hidden],
#sheet-horse-quick [hidden] { display: none !important; }

#tab-caballos .hp-pagehead {
    /* Pegada bajo la barra superior, como en Hoy */
    top: calc(4.25rem + var(--safe-area-inset-top, env(safe-area-inset-top)));
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
}
@media (min-width: 768px) {
    #tab-caballos .hp-pagehead { top: calc(4.75rem + var(--safe-area-inset-top, env(safe-area-inset-top))); margin-inline: -1.5rem; padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
    #tab-caballos .hp-pagehead { top: 0; }
}

.hp-input--lg { min-height: var(--hp-tap-lg); }
.hp-horse-search { position: relative; }
.hp-horse-search .hp-input { min-height: var(--hp-tap-lg); padding-left: 3rem; }
.hp-horse-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.hp-horse-search-ico { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: var(--hp-text-2); pointer-events: none; }

/* Foto redonda o inicial */
.hp-avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    overflow: hidden;
    object-fit: cover;
    background: var(--hp-cuero-100);
    border: 1px solid var(--hp-cuero-200);
}
.hp-avatar > img { width: 100%; height: 100%; object-fit: cover; }
.hp-avatar--ini { font-family: var(--hp-font-num); font-size: 1.5rem; font-weight: 800; color: var(--hp-cuero-700); }
.hp-avatar--lg { width: 4rem; height: 4rem; font-size: 1.75rem; }

/* Lista: filas en móvil, dos columnas en tablet */
.hp-horses { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.625rem; padding-bottom: 0.5rem; }
@media (min-width: 640px) { .hp-horses { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; } }
@media (min-width: 1280px) { .hp-horses { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hp-horses-full { grid-column: 1 / -1; }
.hp-horse {
    width: 100%;
    min-height: 5rem;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.hp-horse:active { transform: scale(0.99); }
.hp-horse:hover { background: var(--hp-cuero-50); }
.hp-horse:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-horse-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-horse-main > .hp-row-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
.hp-horse-main > .hp-row-sub { display: block; }
.hp-horse-line { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#horse-edit-actions .hp-btn { white-space: nowrap; }
#horse-edit-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hp-horse-health { flex: none; }
@media (min-width: 768px) {
    .hp-horse { min-height: 5.75rem; padding: 0.75rem 0.875rem; gap: 0.875rem; }
    .hp-horse .hp-avatar { width: 4rem; height: 4rem; }
}

/* Alta y edición */
#sheet-new-horse .hp-t-meta,
#sheet-horse-quick .hp-t-meta { margin: 0; }
.hp-horse-form { display: flex; flex-direction: column; gap: 1.25rem; }
.hp-horse-form .hidden { display: none !important; }
.hp-horse-form-sec { display: flex; flex-direction: column; gap: 0.75rem; }
.hp-horse-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
@media (min-width: 768px) {
    .hp-horse-form-grid { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
    .hp-horse-form-grid:has(> .hp-horse-form-wide) { grid-template-columns: 2fr 1fr; }
}
.hp-horse-owner { display: flex; gap: 0.5rem; }
.hp-horse-owner .hp-picker-btn { flex: 1; min-width: 0; }
.hp-horse-owner .hp-btn { flex: none; }
.hp-horse-form > [type="submit"] { margin-top: 0.25rem; }
#sheet-new-horse .hp-eyebrow { margin-top: 0.25rem; }

/* Ficha rápida */
.hq-body { display: flex; flex-direction: column; gap: 1rem; }
.hq-alert { align-items: flex-start; min-height: 0; padding: 0.75rem; }
.hq-alert > .hp-i { margin-top: 0.125rem; }
.hq-alert > span { font-size: var(--hp-fs-body); font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.hq-alert b { display: block; font-size: var(--hp-fs-meta); font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--hp-warn); }
.hq-alert.hp-banner--bad b { color: var(--hp-bad); }
.hq-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0.75rem; }
.hq-contact { min-height: 4.5rem; padding-right: 0.625rem; gap: 0.5rem; }
.hq-due { padding-right: 0.625rem; }
.hq-contact-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hq-contact-txt > .hp-row-title { display: block; }
.hq-due-btn { flex: none; }
.hq-nophone { margin: 0; }
.hq-kv { padding: 0 0.25rem; }
.hq-group { border-top: 1px solid var(--hp-line); }
.hq-group .hp-group { min-height: var(--hp-tap-lg); font-size: var(--hp-fs-body); color: var(--hp-text); }
.hq-group-aside { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--hp-text-2); font-size: var(--hp-fs-meta); font-weight: 700; }
.hq-group .hp-group[aria-expanded="true"] .hp-chip .hp-i { transform: none; }
.hq-group-body { padding: 0.25rem 0 0.5rem; }
.hq-menu { border-top: 1px solid var(--hp-line); }
.hq-menu .hp-i { color: var(--hp-cuero-700); }
.hq-body > .hq-group + .hq-group,
.hq-body > .hq-group + .hq-menu { margin-top: -1rem; }
@media (min-width: 768px) {
    /* En tablet el alta es la completa: el aviso de «solo el nombre» es del móvil */
    .hp-horse-form .hp-field-only { display: none !important; }
}

/* ---------- Pantalla Salud ---------- */
#tab-salud [hidden],
#sheet-due-detail [hidden] { display: none !important; }

#tab-salud .hp-pagehead {
    /* Pegada bajo la barra superior, como en Hoy y Caballos */
    top: calc(4.25rem + var(--safe-area-inset-top, env(safe-area-inset-top)));
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
}
@media (min-width: 768px) {
    #tab-salud .hp-pagehead { top: calc(4.75rem + var(--safe-area-inset-top, env(safe-area-inset-top))); margin-inline: -1.5rem; padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
    #tab-salud .hp-pagehead { top: 0; }
}
/* Con «Apuntar» a la vista (tablet táctil) manda él; «Cita» queda como secundario */
body.hp-touch #tab-salud .sal-cita { background: var(--hp-card); color: var(--hp-text); border-color: var(--hp-line-strong); }
body.hp-touch #tab-salud .sal-cita:hover { background: var(--hp-cuero-50); }

/* Lo que toca: grupos «Vencido» y «Próximos 15 días» */
.sal-groups { display: flex; flex-direction: column; gap: 1.25rem; }
.sal-group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
    padding: 0 0.25rem;
    font-size: var(--hp-fs-strong);
    font-weight: 800;
    line-height: 1.2;
}
.sal-group-head > b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.875rem;
    height: 1.875rem;
    padding: 0 0.5rem;
    border-radius: 99px;
    background: var(--hp-muted);
    border: 1px solid var(--hp-line);
    font-family: var(--hp-font-num);
    font-size: var(--hp-fs-meta);
    font-weight: 900;
}
.sal-group-head--bad { color: var(--hp-bad); }
.sal-group-head--bad > b { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
.sal-group-head--warn { color: var(--hp-warn); }
.sal-group-head--warn > b { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); }
.sal-rows { gap: 0.75rem; }
.sal-row .hp-row-main { min-height: 4.5rem; }
.sal-row .hp-row-sub .hp-i { flex: none; }
.sal-row .hp-row-sub { gap: 0.375rem; }
.sal-done { min-width: 6.75rem; flex: none; }

/* Detalle de una fila (cajón) */
.sal-detail { display: flex; flex-direction: column; gap: 1.25rem; }
.sal-detail-what { display: flex; align-items: center; gap: 0.875rem; }
.sal-detail-what > .hp-i { flex: none; width: 2.5rem; height: 2.5rem; color: var(--hp-cuero-600); }
.sal-detail-what .hp-t-title { margin: 0 0 0.375rem; }

/* Cabecera de los cajones de Salud (mismo patrón que el alta de caballo) */
#sheet-new-appointment .hp-t-meta,
#sheet-vaccine .hp-t-meta,
#sheet-deworm .hp-t-meta { margin: 0; }

/* Formularios de cita, vacuna y desparasitación */
.sal-form { display: flex; flex-direction: column; gap: 1.25rem; }
.sal-form .hidden,
.sal-form [hidden] { display: none !important; }
.sal-form-sec { display: flex; flex-direction: column; gap: 1rem; }
.sal-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.sal-form > [type="submit"] { margin-top: 0.25rem; }
.sal-form .hp-seg > button { min-height: 3.5rem; }
.sal-form .hp-toggle { padding: 0.25rem 0; }

/* Oficina: fichas por caballo */
.sal-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
@media (min-width: 1280px) { .sal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; } }
.sal-list > .sal-upcoming,
.sal-list > .hp-empty { grid-column: 1 / -1; }
.sal-upcoming .hp-row { padding-right: 0.625rem; }
.sal-upcoming .hp-row-main { min-height: 4rem; }
/* En la tablet táctil «lo que toca» ya va arriba: las citas de esta lista sobran */
@media (min-width: 768px) { body.hp-touch .sal-upcoming { display: none; } }
.sal-sema-head { grid-column: 1 / -1; margin: 0; padding: 0.5rem 0.25rem 0; font-size: var(--hp-fs-strong); font-weight: 800; }
body:not(.hp-touch) .sal-sema-head { display: none; }
.sal-horse { display: flex; flex-direction: column; gap: 0.875rem; }
.sal-horse-head { display: flex; align-items: flex-start; gap: 0.75rem; }
.sal-horse-id { flex: 1; min-width: 0; }
.sal-horse-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sal-horse-meta { margin: 0.125rem 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sal-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.5rem; }
.sal-tile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    min-height: 3.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
}
.sal-tile--bad { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
.sal-tile--warn { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); }
.sal-tile-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: var(--hp-cuero-100);
    color: var(--hp-cuero-700);
}
.sal-tile-ico .hp-i { width: 1.25rem; height: 1.25rem; }
.sal-tile-txt { flex: 1 1 6rem; min-width: 0; display: flex; flex-direction: column; gap: 0.0625rem; }
.sal-tile-txt b { font-size: var(--hp-fs-body); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sal-tile-txt small { font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); line-height: 1.3; }
.sal-tile-extra { color: var(--hp-text-2); font-weight: 600; font-size: var(--hp-fs-meta); }
/* Vacuna · Desparasitar · Cita: cada botón a su ancho; si no caben, el último baja a otra fila (antes «Desparasitar» se salía) */
.sal-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sal-actions .hp-btn { flex: 1 1 auto; padding: 0 0.75rem; white-space: nowrap; }

/* Oficina: historial */
.sal-history { padding: 0; overflow: hidden; }
.sal-history-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--hp-line); }
.sal-history-head > .hp-t-title { margin: 0 auto 0 0; }
.sal-history-seg { min-width: min(100%, 26rem); }
.sal-history-seg > button { min-height: 3rem; }
.sal-history-horse { flex: 0 1 14rem; min-width: 11rem; position: relative; }
.sal-hist-list { padding: 0.75rem; max-height: 42rem; overflow-y: auto; gap: 0.5rem; }
.sal-hist-row { padding-right: 0.625rem; }
.sal-hist-row .hp-row-main { min-height: 4rem; }
.sal-hist-row .hp-row-sub { gap: 0.5rem; }
.sal-hist-row .hp-row-sub .hp-i { flex: none; }
#hh-body > .hp-empty { padding: 2rem 1rem; }

/* ---------- Pantalla Plan ---------- */
/* Plan semanal (#tab-plan, js/views/plan.js): cabecera, semana en filas (móvil) o rejilla (tablet y PC),
   tabla de cuadra y cajones del día, de la semana y de los ejercicios. */
#tab-plan .hp-pagehead { position: static; padding-top: 0.25rem; }
.plan-views { width: 15.5rem; flex: none; }
.plan-views > button { flex-direction: row; gap: 0.375rem; min-height: 3rem; font-size: var(--hp-fs-body); }
.plan-controls { display: flex; flex-direction: column; gap: 0.625rem; }
.plan-horse-row { position: relative; min-width: 0; }
.plan-weeknav { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.plan-weeknav-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.plan-weeknav-mid > .hp-t-title { white-space: nowrap; font-variant-numeric: tabular-nums; }
.plan-weeknav-mid > .hp-btn { min-height: 2.75rem; padding: 0 0.75rem; color: var(--hp-cuero-700); font-size: var(--hp-fs-meta); }
@media (min-width: 768px) {
    .plan-controls { flex-direction: row; align-items: center; gap: 1rem; }
    .plan-horse-row { flex: 0 0 22rem; }
    .plan-weeknav { flex: 1; }
}

/* Colores por tipo de trabajo (variables que heredan filas, botones y chips) */
#tab-plan [data-day-type="monta"], #tab-plan .hp-wt-monta { --wt-bg: #F6DDBF; --wt-bd: #C98A3C; }
#tab-plan [data-day-type="cuerda"], #tab-plan .hp-wt-cuerda { --wt-bg: #DCE9F7; --wt-bd: #6F9BD1; }
#tab-plan [data-day-type="caminador"], #tab-plan .hp-wt-caminador { --wt-bg: #E3DDF5; --wt-bd: #8D7BC9; }
#tab-plan [data-day-type="paddock"], #tab-plan .hp-wt-paddock { --wt-bg: #DDEFD3; --wt-bd: #74AC57; }
#tab-plan [data-day-type="paseo"], #tab-plan .hp-wt-paseo { --wt-bg: #D3EEEA; --wt-bd: #4FA69A; }
#tab-plan [data-day-type="salto"], #tab-plan .hp-wt-salto { --wt-bg: #FBD9D3; --wt-bd: #D97A68; }
#tab-plan [data-day-type="descanso"], #tab-plan .hp-wt-descanso { --wt-bg: #ECE7E1; --wt-bd: #B5A898; }

/* Semana */
.plan-cal { display: flex; flex-direction: column; gap: 1.25rem; }
.plan-week { display: flex; flex-direction: column; gap: 0.625rem; min-width: 0; }
.plan-week-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.plan-week-name { font-size: var(--hp-fs-strong); font-weight: 800; color: var(--hp-text); }
.plan-week.is-single .plan-week-name { display: none; }
.plan-week.is-single .plan-week-head { justify-content: flex-end; }
.plan-days { display: flex; flex-direction: column; gap: 0.5rem; }

/* Un día en fila (móvil) */
.hp-row.hp-plan-day { width: 100%; min-height: 4.5rem; padding: 0.5rem 0.75rem 0.5rem 0.625rem; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.hp-row.hp-plan-day[class*="hp-wt-"] { background: var(--hp-card); border-color: var(--hp-line); }
.hp-row.hp-plan-day.is-today { border-color: var(--hp-cuero-600); box-shadow: inset 0 0 0 2px var(--hp-cuero-600); }
.hp-row.hp-plan-day.is-editing { outline: 3px solid var(--hp-cuero-900); outline-offset: 2px; }
.hp-row.hp-plan-day:focus-visible, .hp-cal-cell:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.plan-dow { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 2.75rem; line-height: 1.05; }
.plan-dow small { font-size: var(--hp-fs-meta); font-weight: 700; color: var(--hp-text-2); text-transform: uppercase; }
.plan-dow b { font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; font-variant-numeric: tabular-nums; }
.hp-plan-day.is-today .plan-dow small { color: var(--hp-cuero-700); }
.plan-ico {
    flex: none; display: flex; align-items: center; justify-content: center; width: 3rem; height: 3rem;
    border-radius: var(--hp-r-ctl); border: 2px dashed var(--hp-line-strong); background: var(--hp-card); color: var(--hp-text-2);
}
.hp-plan-day[class*="hp-wt-"] .plan-ico { background: var(--wt-bg); border: 2px solid var(--wt-bd); color: var(--hp-cuero-900); }
.plan-day-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.plan-day-title { font-size: var(--hp-fs-strong); font-weight: 700; line-height: 1.2; }
.plan-day-title.is-empty { color: var(--hp-text-2); font-weight: 600; }
.hp-plan-day > .hp-i { color: var(--hp-text-2); }

/* Rejilla de 7 columnas (tablet y ordenador) */
.plan-grid-head, .plan-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.375rem; }
.plan-dow-h { text-align: center; font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-text-2); }
.plan-dow-h.is-today { color: var(--hp-cuero-700); }
.plan-grid .hp-cal-cell, .plan-strip .hp-cal-cell { min-height: 4.75rem; border-radius: var(--hp-r-ctl); }
.hp-cal-num { font-size: var(--hp-fs-meta); font-weight: 800; top: 3px; left: 6px; }
.plan-grid .hp-cal-cell { padding-top: 1.375rem; }
.hp-cal-icon > .hp-i { width: 1.75rem; height: 1.75rem; }
.hp-cal-cell:not([class*="hp-wt-"]) .hp-cal-icon > .hp-i { width: 1.25rem; height: 1.25rem; }
.hp-cal-name { font-size: var(--hp-fs-meta); font-weight: 800; }
.hp-cal-mark { width: 1.375rem; height: 1.375rem; }
.hp-cal-mark > .hp-i { width: 0.8125rem; height: 0.8125rem; stroke-width: 3.5; }
.hp-cal-cell.is-small { min-height: 3rem; padding: 0.25rem 0.125rem; }
.hp-cal-cell.is-small .hp-cal-icon > .hp-i { width: 1.375rem; height: 1.375rem; }
@media (min-width: 1024px) {
    .plan-grid .hp-cal-cell { min-height: 5.25rem; }
}

/* Leyenda: solo donde los dibujos no llevan nombre */
.plan-legend { display: none; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.75rem; }
.plan-legend .hp-chip { min-height: 2.25rem; }
.plan-legend .hp-chip[class*="hp-wt-"] { border-width: 1px; border-style: solid; color: var(--hp-cuero-900); }
@media (min-width: 768px) { #tab-plan[data-plan-view="horse"] .plan-legend { display: flex; } }
#tab-plan[data-plan-view="stable"] .plan-legend { display: flex; }

/* Puntos de intensidad */
.plan-dot { display: inline-block; flex: none; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--hp-warn); }
.plan-dot.is-short { background: #2E7D32; }
.plan-dot.is-standard { background: #E0A100; }
.plan-dot.is-intense { background: #C62828; }

/* Toda la cuadra: tabla (tablet y ordenador) */
.plan-stable-scroll { overflow-x: auto; overscroll-behavior-x: contain; padding: 0.25rem; margin: -0.25rem; }
#plan-cal .hp-stable-grid { grid-template-columns: minmax(7rem, 10rem) repeat(7, minmax(4.25rem, 1fr)); gap: 0.375rem; min-width: 39rem; align-items: stretch; }
#plan-cal .hp-stable-grid .hp-cal-cell { min-height: 3.75rem; padding-top: 0.25rem; }
.hp-stable-grid .plan-dow-h { align-self: end; padding-bottom: 0.25rem; }
.plan-stable-cell {
    position: sticky; left: 0; z-index: 2; display: flex; align-items: center; min-width: 0; min-height: 3.75rem;
    padding: 0.25rem 0.5rem 0.25rem 0; background: var(--hp-bg); border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.plan-stable-cell .plan-stable-name, .plan-stable-head .plan-stable-name { min-width: 0; display: flex; flex-direction: column; gap: 0.0625rem; flex: 1; }
.plan-stable-cell .hp-row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Toda la cuadra: tarjetas por caballo (móvil) */
.plan-stable-list { display: flex; flex-direction: column; gap: 0.75rem; }
.plan-stable-card { display: flex; flex-direction: column; gap: 0.625rem; padding: 0.75rem 0.5rem; }
.plan-stable-card .plan-stable-head { padding: 0 0.25rem; }
.plan-stable-head { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; padding: 0; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.plan-stable-head > .hp-i { color: var(--hp-text-2); }
/* Las 7 casillas llegan a 48 px de ancho: la tira sale un poco de la tarjeta y el hueco es mínimo */
.plan-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.125rem; margin: 0 -0.5rem; }
.plan-strip .hp-cal-cell { min-height: 5rem; padding: 2.5rem 0 0.25rem; border-radius: 0.625rem; }
.plan-strip .hp-cal-num { left: 0; right: 0; text-align: center; line-height: 1.15; }
.plan-strip .hp-cal-icon > .hp-i { width: 1.5rem; height: 1.5rem; }
.plan-strip .hp-cal-cell:not([class*="hp-wt-"]) .hp-cal-icon > .hp-i { width: 1.125rem; height: 1.125rem; }
.plan-strip .hp-cal-mark { top: -6px; right: -4px; width: 1.25rem; height: 1.25rem; }

/* Cajones (móvil y tablet): el día, la semana y los ejercicios salen desde abajo con fondo oscuro.
   En ordenador (>= 1024 px) siguen en la columna de la derecha. */
.plan-grip { display: none; }
.plan-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0 0.75rem; border-bottom: 1px solid var(--hp-line); }
.plan-sheet-head .hp-t-title { line-height: 1.15; }
.plan-ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1023px) {
    #tab-plan.plan-has-overlay::before { content: ''; position: fixed; inset: 0; z-index: 54; background: rgba(28, 24, 22, 0.5); }
    #tab-plan .hp-plan-panel {
        inset: auto 0 0 0;
        width: 100%;
        max-width: 44rem;
        margin-inline: auto;
        height: auto;
        max-height: calc(100dvh - var(--hp-safe-top, 0px) - 1rem);
        padding-top: 0;
        border-radius: var(--hp-r-sheet) var(--hp-r-sheet) 0 0;
        box-shadow: 0 -14px 40px -10px rgba(42, 19, 8, 0.4);
    }
    #tab-plan .hp-plan-panel--top { height: calc(100dvh - var(--hp-safe-top, 0px) - 2.5rem); }
    .plan-grip { display: block; width: 2.5rem; height: 0.3125rem; margin: 0 auto; border-radius: 99px; background: var(--hp-line-strong); }
    #tab-plan .hp-plan-panel .hp-sheet-top { padding-top: 0.625rem; }
}
#tab-plan .hp-plan-panel .hp-sheet-body { padding-top: 1rem; }
aside .hp-plan-side-empty.hp-empty { display: none; }
@media (min-width: 1024px) {
    aside .hp-plan-side-empty.hp-empty { display: flex; height: 100%; align-items: center; justify-content: center; border: 2px dashed var(--hp-line-strong); border-radius: var(--hp-r-sheet); background: var(--hp-cuero-50); }
}

/* Día: formulario */
.plan-form { display: flex; flex-direction: column; gap: 1.25rem; }
.plan-opt { font-weight: 600; opacity: 0.85; }
.hp-seg.plan-types { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr)); }
.hp-seg.plan-types > button, .hp-seg.plan-presets > button, .hp-seg.plan-status > button {
    flex-direction: row; justify-content: flex-start; gap: 0.5rem; min-height: 3.5rem; padding: 0 0.75rem;
    border: 2px solid transparent; font-size: var(--hp-fs-body);
}
.hp-seg.plan-presets > button, .hp-seg.plan-status > button { justify-content: center; padding: 0 0.375rem; gap: 0.375rem; }
.hp-seg.plan-status > button { font-size: var(--hp-fs-meta); flex-direction: column; gap: 0.125rem; }
.hp-seg.plan-types > button.is-active { background: var(--wt-bg, var(--hp-card)); border-color: var(--wt-bd, var(--hp-cuero-600)); color: var(--hp-cuero-900); box-shadow: 0 0 0 2px var(--hp-cuero-700); }
.hp-seg.plan-types > button[data-day-type=""].is-active { background: var(--hp-card); border-color: var(--hp-line-strong); }
.hp-seg.plan-presets > button.is-active, .hp-seg.plan-status > button.is-active { border-color: var(--hp-cuero-600); }
.plan-min { display: flex; align-items: center; gap: 0.75rem; }
.plan-min-val { flex: 1; text-align: center; font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; font-variant-numeric: tabular-nums; }
.plan-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.625rem; }
.plan-exchip {
    display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; min-height: 3rem; padding: 0 0 0 0.875rem;
    border-radius: 99px; border: 2px solid var(--hp-cuero-200); background: var(--hp-cuero-50); font-size: var(--hp-fs-body); font-weight: 700;
}
.plan-exchip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-exchip > button { flex: none; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--hp-text-2); border-radius: 50%; cursor: pointer; }
.plan-note-toggle { border-top: 1px solid var(--hp-line); min-height: var(--hp-tap-lg); font-size: var(--hp-fs-body); color: var(--hp-text); }
.plan-note-toggle > span { font-weight: 700; }
.plan-note > div { padding-bottom: 0.25rem; }
.plan-foot { display: grid; grid-template-columns: 1.45fr 1fr; gap: 0.75rem; padding-bottom: calc(0.75rem + var(--hp-safe-bottom, 0px)); }
.plan-foot .hp-btn--secondary { font-size: var(--hp-fs-body); padding: 0 0.5rem; }
@media (min-width: 1024px) { .plan-foot { padding-bottom: 0.75rem; } }

/* Ejercicios: buscador y tarjetas */
.plan-search { position: relative; padding: 0.625rem 0 0.75rem; }
.plan-search .hp-input { padding-left: 2.75rem; }
.plan-search-ico { position: absolute; left: 0.875rem; top: calc(0.625rem + 0.75rem); color: var(--hp-text-2); pointer-events: none; display: flex; }
.plan-ex-list { display: flex; flex-direction: column; gap: 0.625rem; }
.plan-ex-head { display: flex; align-items: center; gap: 0.375rem; margin-top: 0.5rem; }
.plan-ex { border: 2px solid var(--hp-line); border-radius: var(--hp-r-card); background: var(--hp-card); overflow: hidden; }
.plan-ex.is-on { border-color: var(--hp-ok); background: var(--hp-ok-bg); }
.plan-ex.is-blocked { opacity: 0.55; }
.plan-ex-main { display: flex; align-items: stretch; }
.plan-ex-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem; min-height: 4.5rem; padding: 0.625rem 0.25rem 0.625rem 0.875rem; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.plan-ex-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.plan-ex-title { font-size: var(--hp-fs-strong); font-weight: 700; line-height: 1.2; }
.plan-ex-hint { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-ex-meta { font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-cuero-700); text-transform: uppercase; letter-spacing: 0.03em; }
.plan-ex-check { flex: none; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--hp-muted); color: var(--hp-text); }
.plan-ex.is-on .plan-ex-check { background: var(--hp-ok); color: #fff; }
.plan-ex-main > .hp-btn { align-self: center; flex: none; margin-right: 0.25rem; color: var(--hp-cuero-700); }
.plan-ex-desc { padding: 0 0.875rem 0.875rem; display: flex; flex-direction: column; gap: 0.375rem; }
.plan-ex-desc.hidden { display: none; }

/* Menú de la semana */
.plan-wkmenu > button > span { flex: 1; min-width: 0; }
.plan-wkmenu > button > .hp-i:first-child { color: var(--hp-cuero-700); }
.plan-wkmenu > button[aria-expanded="true"] .plan-wk-chev { transform: rotate(90deg); }
.plan-wk-sec { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.25rem 0 1rem; border-bottom: 1px solid var(--hp-line); }
.plan-wk-sec.hidden { display: none; }
.plan-repeat { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; }
.plan-repeat .hp-btn { padding: 0; font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; }
.plan-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.plan-tpl-preview { display: flex; flex-direction: column; gap: 0.5rem; }
.plan-tpl-preview:empty { display: none; }
.plan-tpl-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem; }

/* ---------- Pantalla Raciones y Almacén ---------- */
#tab-raciones [hidden],
#tab-almacen [hidden] { display: none !important; }
.rt-form .hidden,
.al-form .hidden { display: none !important; }

/* Cabeceras pegadas bajo la barra superior, como en Caballos */
#tab-raciones .hp-pagehead,
#tab-almacen .hp-pagehead {
    top: calc(4.25rem + var(--safe-area-inset-top, env(safe-area-inset-top)));
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
}
@media (min-width: 768px) {
    #tab-raciones .hp-pagehead,
    #tab-almacen .hp-pagehead { top: calc(4.75rem + var(--safe-area-inset-top, env(safe-area-inset-top))); margin-inline: -1.5rem; padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
    #tab-raciones .hp-pagehead,
    #tab-almacen .hp-pagehead { top: 0; }
}
.rt-body, .al-body { display: flex; flex-direction: column; gap: 0.75rem; }
#rt-banner:empty, #al-banner:empty { display: none; }
#rt-banner .hp-banner > b, #al-banner .hp-banner > b { flex: none; font-weight: 800; color: var(--hp-cuero-700); }
#al-banner .hp-banner--bad > b { color: var(--hp-bad); }

/* Raciones: tomas arriba y una ficha por caballo (mismo formato que la ficha de box de Cuadra) */
.rt-seg > button { flex-direction: row; gap: 0.375rem; min-height: 3.25rem; padding: 0 0.5rem; }
.rt-seg > button .hp-i { flex: none; }
@media (max-width: 1023px) { .rt-screen .rt-seg > button { font-size: var(--hp-fs-meta); flex-direction: column; gap: 0.0625rem; } }
.rt-card.is-empty { border-style: dashed; }
.rt-name { cursor: default; font-size: var(--hp-fs-title); font-family: var(--hp-font-num); font-weight: 800; }
.rt-meal { margin: 0.5rem 0 0; display: flex; align-items: center; gap: 0.375rem; font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-cuero-700); text-transform: uppercase; letter-spacing: 0.03em; }
.rt-lines { margin: 0; }
.rt-lines li { display: block; }
.rt-line {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: var(--hp-tap);
    padding: 0.25rem 0.25rem 0.25rem 0;
    border: 0;
    border-bottom: 1px solid var(--hp-line);
    background: none;
    color: var(--hp-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.rt-lines li:last-child .rt-line { border-bottom: 0; }
.rt-line:hover { background: var(--hp-cuero-50); }
.rt-line:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: -2px; border-radius: var(--hp-r-ctl); }
.rt-qty-v { font-size: var(--hp-fs-strong); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-prod { font-size: var(--hp-fs-body); font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.rt-prod small { display: block; font-size: var(--hp-fs-meta); font-weight: 500; color: var(--hp-text-2); }
.rt-line > .hp-i { color: var(--hp-text-2); }
.rt-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.rt-actions.is-single { grid-template-columns: minmax(0, 1fr); }

/* Cajón de ración y de producto */
.rt-form, .al-form { display: flex; flex-direction: column; gap: 1.25rem; }
.rt-form .rt-seg > button { flex-direction: column; min-height: 4rem; font-size: var(--hp-fs-meta); }
.rt-suggest { margin-top: 0.5rem; }
.rt-suggest > button[aria-pressed="true"] { background: var(--hp-cuero-600); border-color: var(--hp-cuero-600); color: #fff; }
.rt-qty { display: flex; gap: 0.5rem; align-items: stretch; }
.rt-qty .hp-btn { flex: none; }
.rt-qty .hp-input { flex: 1; min-width: 0; text-align: center; font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; }
.al-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
@media (min-width: 640px) { .al-form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; } }
.al-bigqty { text-align: center; font-family: var(--hp-font-num); font-size: var(--hp-fs-fig); font-weight: 900; min-height: 4.5rem; }
#sheet-ration .hp-t-meta,
#sheet-inventory .hp-t-meta,
#sheet-inventory-item .hp-t-meta,
#sheet-inventory-restock .hp-t-meta { margin: 0; }
#al-restock-now { margin: 0; }

/* Almacén: contadores, lista y fila de producto */
.al-stat-bad b { color: var(--hp-bad); }
.al-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.625rem; }
@media (min-width: 1100px) { #inv-table .al-list { grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr)); } }
.al-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    row-gap: 0.375rem;
    align-items: center;
    padding: 0.75rem 0.875rem 0.875rem;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-card);
    box-shadow: var(--hp-sh-card);
}
.al-item.is-red { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); box-shadow: none; }
.al-item.is-amber { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); box-shadow: none; }
.al-main { grid-column: 1; grid-row: 1; padding: 0; }
.al-main .hp-row-title { font-size: var(--hp-fs-strong); }
.al-fig { grid-column: 2; grid-row: 1; margin: 0; display: flex; align-items: baseline; justify-content: flex-end; gap: 0.375rem; text-align: right; white-space: nowrap; }
.al-fig b { font-family: var(--hp-font-num); font-size: var(--hp-fs-fig); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.al-fig span { font-size: var(--hp-fs-meta); font-weight: 700; color: var(--hp-text-2); }
.al-item.is-red .al-fig b { color: var(--hp-bad); }
.al-item.is-amber .al-fig b { color: var(--hp-warn); }
.al-meter { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; min-height: 2rem; }
.al-bar { flex: 1; min-width: 0; }
.al-item.is-red .hp-progress-bar > i { background: var(--hp-bad); }
.al-item.is-amber .hp-progress-bar > i { background: var(--hp-warn); }
.al-item.is-green .hp-progress-bar > i { background: var(--hp-ok); }
.al-item.is-neutral .hp-progress-bar > i { background: var(--hp-cuero-600); }
.al-acts { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; margin-top: 0.25rem; }
.al-acts .hp-btn--secondary { background: var(--hp-card); }

/* ---------- Pantalla Ajustes ---------- */
/* Ajustes: lista agrupada tipo app nativa (etiqueta + tarjeta con filas de 60 px). También lo usan Equipo, Suscripción, Ayuda y Mis caballos. */
.hp-set { display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 1rem; }
.hp-set-extra { display: contents; }
.hp-set-group { display: flex; flex-direction: column; gap: 0.5rem; }
.hp-set-group > .hp-eyebrow { padding: 0 0.25rem; }
.hp-set-group.hidden, .hp-por-sec.hidden { display: none; }
.hp-set-list { padding: 0; overflow: hidden; }
.hp-set-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-set-title { font-size: var(--hp-fs-strong); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.hp-set-sub { font-size: var(--hp-fs-meta); font-weight: 600; line-height: 1.3; color: var(--hp-text-2); overflow-wrap: anywhere; }
.hp-set-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    min-height: 3.75rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--hp-line);
    border-radius: 0;
    color: var(--hp-text);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.hp-set-list > :last-child { border-bottom: 0; }
.hp-set-row > .hp-i { flex: none; width: 1.5rem; height: 1.5rem; color: var(--hp-cuero-700); }
.hp-set-row > .hp-chev, .hp-set-row .hp-chev { flex: none; width: 1.25rem; height: 1.25rem; color: var(--hp-text-2); }
button.hp-set-row:hover, a.hp-set-row:hover, summary.hp-set-row:hover { background: var(--hp-cuero-50); }
button.hp-set-row:active, a.hp-set-row:active { background: var(--hp-cuero-100); }
.hp-set-row:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: -3px; }
.hp-set-row--static { cursor: default; }
.hp-set-row--wrap { flex-wrap: wrap; }
.hp-set-row--wrap > .hp-seg { flex: 1 1 100%; }
.hp-set-row.hp-toggle { justify-content: space-between; }
.hp-set-row .hp-btn { flex: none; }

/* Tu cuenta */
.hp-set-account { display: flex; align-items: center; gap: 1rem; }
.hp-set-account .hp-avatar .hp-i { width: 1.75rem; height: 1.75rem; }
.hp-set-account .hp-t-title { overflow-wrap: anywhere; }
.hp-set-chips { margin: 0.375rem 0 0; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.hp-set-role:empty { display: none; }

/* Suscripción */
.hp-sub { display: flex; flex-direction: column; gap: 0.875rem; }
.hp-sub-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.hp-sub-head > .hp-chip { flex: none; }
.hp-sub-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
@media (min-width: 520px) { .hp-sub-actions { grid-template-columns: 1fr 1fr; } }
.hp-sub-plan { justify-content: space-between; }

/* Ayuda: preguntas que se abren y mensaje al equipo */
.hp-faq > summary { list-style: none; }
.hp-faq > summary::-webkit-details-marker { display: none; }
.hp-faq .hp-chev { transition: transform 0.15s; }
.hp-faq[open] > summary .hp-chev { transform: rotate(180deg); }
.hp-faq-a { margin: 0; padding: 0 1rem 1rem; color: var(--hp-text-2); }
.hp-set-list > .hp-faq { border-bottom: 1px solid var(--hp-line); }
.hp-set-list > .hp-faq:last-child { border-bottom: 0; }
.hp-faq > summary.hp-set-row { border-bottom: 0; }
.hp-set-support { display: flex; flex-direction: column; gap: 0.75rem; }
.hp-set-support .hp-banner { margin: 0; }

/* Cerrar sesión y eliminar */
.hp-set-session { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.625rem; padding-top: 0.25rem; }
@media (min-width: 640px) { .hp-set-session { grid-template-columns: 1fr 1fr; } }

/* Cajones de Ajustes */
.hp-set-sheet-head { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--hp-line); }
.hp-set-sheet-head > div { flex: 1; min-width: 0; }
.hp-set-sheet-head .hp-t-meta { margin: 0; }
.hp-set-sheet-name { margin: 0; font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.hp-set-form { display: flex; flex-direction: column; gap: 1rem; }
.hp-set-form .hidden { display: none !important; }
.hp-set-form > p { margin: 0; }
.hp-set-pro { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.hp-set-pro > legend { display: flex; align-items: center; gap: 0.5rem; padding: 0; margin-bottom: 0.5rem; }
.hp-set-pro > legend .hp-i { color: var(--hp-cuero-700); }
.hp-set-code { text-transform: uppercase; letter-spacing: 0.12em; font-size: var(--hp-fs-title); }
.hp-set-code-big { font-size: var(--hp-fs-title); letter-spacing: 0.12em; }
.hp-set-sheet .hp-banner { margin: 0; }
.hp-set-sheet .hp-banner > b { font-weight: 800; }

/* Equipo: una persona = una fila; el papel va debajo con selector táctil */
.hp-team-m { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.5rem 0.75rem; padding: 0.625rem 0.75rem; }
.hp-team-m > .hp-picker-btn { grid-column: 1 / -1; }
.hp-team-m .hp-row-title, .hp-team-m .hp-row-sub { display: block; white-space: normal; overflow-wrap: anywhere; }
.hp-team-i > .hp-i { flex: none; color: var(--hp-cuero-700); }
.hp-team-i .hp-row-title, .hp-team-i .hp-row-sub { display: block; overflow-wrap: anywhere; white-space: normal; }

/* Mis caballos (vista del propietario) */
.hp-por { display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 1rem; }
.hp-por-sec { display: flex; flex-direction: column; gap: 0.625rem; }
.hp-por-sec > .hp-eyebrow { padding: 0 0.25rem; }
.hp-por-card { display: flex; flex-direction: column; gap: 0.75rem; }
.hp-por-card > .hp-eyebrow { margin-top: 0.25rem; }
.hp-por-note { margin: 0; padding: 0.5rem 0.25rem; }
.hp-por-stable { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0 0.25rem; }
.hp-por-stable .hp-btn { flex: none; }
.hp-por-horse { width: 100%; min-height: 5.25rem; text-align: left; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hp-por-horse:active { transform: scale(0.99); }
.hp-por-horse:hover { background: var(--hp-cuero-50); }
.hp-por-horse:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-por-horse > .hp-chev { flex: none; width: 1.25rem; height: 1.25rem; color: var(--hp-text-2); }
.hp-por-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-por-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.25rem; }
.hp-por-chips:empty { display: none; }
.hp-por-back { align-self: flex-start; }
.hp-por-detail { display: flex; flex-direction: column; gap: 1.25rem; }
.hp-por-head { display: flex; align-items: center; gap: 1rem; }
.hp-por-head .hp-t-h1 { margin: 0; overflow-wrap: anywhere; }
.hp-por-head .hp-t-meta { margin: 0; }
.hp-por-card .hp-row { box-shadow: none; }
.hp-por-card .hp-row > .hp-i { flex: none; color: var(--hp-cuero-700); }
.hp-por-card .hp-row-title, .hp-por-card .hp-row-sub { white-space: normal; overflow-wrap: anywhere; }
.hp-por-when { flex: none; white-space: nowrap; }
.hp-por-more { border: 1px solid var(--hp-line); border-radius: var(--hp-r-card); }
.hp-por-more > summary.hp-set-row { border-bottom: 0; }
.hp-por-more > .hp-list { padding: 0 0.5rem 0.5rem; }
.hp-por-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hp-por-day.is-today { border-color: var(--hp-cuero-600); box-shadow: inset 0 0 0 2px var(--hp-cuero-600); }
.hp-por-dayname { flex: none; width: 4.5rem; white-space: nowrap; font-size: var(--hp-fs-body); font-weight: 600; color: var(--hp-text-2); }
.hp-por-dayname b { font-family: var(--hp-font-num); color: var(--hp-text); }
.hp-por-none { color: var(--hp-text-2); font-weight: 600; }
.hp-por-dot { flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; border-width: 2px; border-style: solid; }
.hp-por-due { display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; }
.hp-por-bill { flex-wrap: wrap; }
.hp-por-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex: none; }
.hp-por-amount b { font-family: var(--hp-font-num); font-size: var(--hp-fs-strong); font-weight: 800; }
.hp-por .hp-empty { padding-top: 3rem; }

@media (min-width: 768px) {
    .hp-set-row { padding: 0.5rem 1.25rem; }
    .hp-set-account { padding: 1.25rem; }
}

/* ---------- Pantalla Cobros ---------- */
/* Avisos de cobro (#tab-pupilaje), Gastos (#tab-gastos), Propietarios (#tab-propietarios) y sus cajones:
   #sheet-invoice, #sheet-new-expense, #sheet-clients y #sheet-client. Mismas filas, cifras y chips en las tres. */
#tab-pupilaje [hidden],
#tab-gastos [hidden],
#tab-propietarios [hidden],
#sheet-invoice [hidden] { display: none !important; }

/* Cabecera fija bajo la barra superior, como en Caballos; los botones pasan a otra línea si no caben */
#tab-pupilaje .hp-pagehead,
#tab-gastos .hp-pagehead,
#tab-propietarios .hp-pagehead {
    top: calc(4.25rem + var(--safe-area-inset-top, env(safe-area-inset-top)));
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
}
@media (min-width: 768px) {
    #tab-pupilaje .hp-pagehead,
    #tab-gastos .hp-pagehead,
    #tab-propietarios .hp-pagehead { top: calc(4.75rem + var(--safe-area-inset-top, env(safe-area-inset-top))); margin-inline: -1.5rem; padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
    #tab-pupilaje .hp-pagehead,
    #tab-gastos .hp-pagehead,
    #tab-propietarios .hp-pagehead { top: 0; }
}
#tab-pupilaje .hp-pagehead-row,
#tab-gastos .hp-pagehead-row,
#tab-propietarios .hp-pagehead-row { flex-wrap: wrap; row-gap: 0.5rem; }
#tab-pupilaje .hp-pagehead-row > .hp-t-h1,
#tab-gastos .hp-pagehead-row > .hp-t-h1,
#tab-propietarios .hp-pagehead-row > .hp-t-h1 { flex: none; }
#tab-pupilaje .hp-pagehead-aside,
#tab-gastos .hp-pagehead-aside,
#tab-propietarios .hp-pagehead-aside { flex-wrap: wrap; gap: 0.5rem; }
/* En tablet vertical los botones van en su propia línea, bajo el título */
@media (max-width: 899px) {
    #tab-pupilaje .hp-pagehead-aside { flex: 1 1 100%; justify-content: flex-start; }
}

/* Cifras con color según lo que significan */
.hp-stat--warn b { color: var(--hp-warn); }
.hp-stat--ok b { color: var(--hp-ok); }

/* Lista: una columna; dos solo en pantalla muy ancha */
.hp-list.cb-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.625rem; align-content: start; }
@media (min-width: 1600px) {
    .hp-list.cb-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cb-list > .hp-empty,
.cb-list > .hp-banner { grid-column: 1 / -1; }

/* Fila: [fecha o inicial] nombre y meta · importe con estado · botones de 48 px */
.cb-row { min-height: 5rem; }
@media (min-width: 768px) {
    .cb-row { gap: 0.875rem; padding: 0.625rem 0.75rem 0.625rem 0.875rem; }
}
.cb-row .hp-row-main > .hp-row-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
.cb-row .hp-row-main > .hp-row-sub { display: block; }
.cb-row > .hp-avatar { width: 3rem; height: 3rem; font-size: 1.25rem; }
.cb-amt { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; text-align: right; }
.cb-amt > b { font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-acts { flex: none; display: flex; align-items: center; gap: 0.5rem; }
.cb-date {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.5rem;
    border-radius: var(--hp-r-ctl);
    background: var(--hp-cuero-100);
    border: 1px solid var(--hp-cuero-200);
    color: var(--hp-cuero-700);
    line-height: 1;
}
.cb-date > b { font-family: var(--hp-font-num); font-size: 1.375rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.cb-date > span { margin-top: 0.125rem; font-size: var(--hp-fs-meta); font-weight: 700; text-transform: uppercase; }
/* Pantalla estrecha (cajón de propietarios en el móvil) */
@media (max-width: 600px) {
    .cb-row > .hp-avatar { display: none; }
    .cb-row > .hp-row-main { flex: 1 1 8rem; }
    /* Con importe y estado no cabe todo en una línea: los botones pasan debajo */
    .cb-row:has(> .cb-amt) { flex-wrap: wrap; }
    .cb-row:has(> .cb-amt) > .cb-acts { width: 100%; justify-content: flex-end; }
}

/* Filtros de Gastos */
.cb-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 1024px) {
    /* El mes («noviembre de 2026» + icono) necesita más sitio que los desplegables */
    .cb-filters { grid-template-columns: minmax(12.5rem, 1.25fr) repeat(3, minmax(0, 1fr)); }
}
.cb-filters .hp-label { margin-bottom: 0.25rem; }
.cb-money { font-family: var(--hp-font-num); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Cajones: cabecera como la de Caballos */
#sheet-invoice .hp-t-meta,
#sheet-new-expense .hp-t-meta,
#sheet-clients .hp-t-meta,
#sheet-client .hp-t-meta { margin: 0; }
#sheet-clients .hp-row-main { cursor: pointer; }

/* Detalle de un aviso */
.cb-detail { display: flex; flex-direction: column; gap: 1.25rem; }
.cb-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; }
.cb-total > div { display: flex; flex-direction: column; gap: 0.25rem; }
.cb-fig { font-family: var(--hp-font-num); font-size: var(--hp-fs-fig); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.cb-kv { grid-template-columns: minmax(0, 1fr) auto; padding-top: 0.875rem; border-top: 1px solid var(--hp-line); }
.cb-kv dt { overflow-wrap: anywhere; }
.cb-kv dd { justify-self: end; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cb-acts2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.cb-detail .hp-menu { border-top: 1px solid var(--hp-line); }
.cb-detail .hp-menu .hp-i { color: var(--hp-cuero-700); }
.cb-detail .hp-menu > .is-danger .hp-i { color: var(--hp-bad); }
.cb-detail .hp-banner { height: auto; padding-block: 0.625rem; }

/* Acceso del propietario (al editar uno) */
.cb-access { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--hp-line); }
.cb-access.hidden,
.cb-access .hidden { display: none !important; }
.cb-access .hp-banner { height: auto; padding-block: 0.625rem; }
.cb-access .hp-row-main { cursor: default; }
.cb-code { font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 900; letter-spacing: 0.15em; }

/* ---------- Pantalla Ficha ---------- */
/* Ficha completa del caballo (#tab-ficha), Montas (#tab-montas) y Calendario (#tab-calendario): pantallas de oficina.
   Mismo patrón que Salud y Caballos: cabecera fija, listas de filas, cifras en hp-stat y el detalle en cajón o panel. */
#tab-ficha [hidden],
#tab-montas [hidden],
#tab-calendario [hidden],
#sheet-cal-day [hidden],
#sheet-ride [hidden] { display: none !important; }

/* Cabecera pegada bajo la barra superior, igual que en Salud */
#tab-ficha .hp-pagehead,
#tab-montas .hp-pagehead,
#tab-calendario .hp-pagehead {
    top: calc(4.25rem + var(--safe-area-inset-top, env(safe-area-inset-top)));
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
}
@media (min-width: 768px) {
    #tab-ficha .hp-pagehead,
    #tab-montas .hp-pagehead,
    #tab-calendario .hp-pagehead { top: calc(4.75rem + var(--safe-area-inset-top, env(safe-area-inset-top))); margin-inline: -1.5rem; padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
    #tab-ficha .hp-pagehead,
    #tab-montas .hp-pagehead,
    #tab-calendario .hp-pagehead { top: 0; }
}
#pf-title { flex: none; }
#pf-chip { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Pie de cifra pequeño bajo un hp-stat («2 h 10 min · 24 km») */
.hp-stat .mt-stat-sub { font-weight: 600; }

/* --- Ficha: foto y datos a la izquierda, secciones a la derecha --- */
.pf-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.pf-side { display: flex; flex-direction: column; gap: 1rem; }
.pf-photo {
    aspect-ratio: 4 / 3;
    border-radius: var(--hp-r-ctl);
    overflow: hidden;
    background: var(--hp-cuero-100);
    border: 1px solid var(--hp-cuero-200);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pf-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-photo-empty .hp-i { width: 4rem; height: 4rem; color: var(--hp-cuero-600); }
.pf-id { min-width: 0; }
.pf-name { margin: 0.125rem 0 0; line-height: 1.1; overflow-wrap: anywhere; }
.pf-sub { margin: 0.25rem 0 0; font-weight: 600; color: var(--hp-text-2); }
.pf-note { padding: 0.75rem; border-radius: var(--hp-r-ctl); border: 1px solid var(--hp-line); }
.pf-note-label { display: flex; align-items: center; gap: 0.375rem; margin: 0; font-size: var(--hp-fs-meta); font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.pf-note-label .hp-i { width: 1.125rem; height: 1.125rem; flex: none; }
.pf-note-text { margin: 0.25rem 0 0; font-size: var(--hp-fs-body); font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; color: var(--hp-text); }
.pf-note--bad { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
.pf-note--bad .pf-note-label { color: var(--hp-bad); }
.pf-note--warn { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); }
.pf-note--warn .pf-note-label { color: var(--hp-warn); }
.pf-side-actions { display: flex; flex-direction: column; gap: 0.75rem; }
.pf-side-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.pf-facts { padding-top: 1rem; border-top: 1px solid var(--hp-line); }
.pf-facts dd { overflow-wrap: anywhere; }

.pf-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.pf-sec { scroll-margin-top: 10rem; }
.pf-sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.pf-sec-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; flex: 1 1 12rem; min-width: 0; margin: 0; }
.pf-sec-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--hp-cuero-100);
    color: var(--hp-cuero-700);
}
.pf-sec-ico .hp-i { width: 1.375rem; height: 1.375rem; }
.pf-sec-title .hp-chip { font-size: var(--hp-fs-meta); }
.pf-sec-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pf-sec-body { display: flex; flex-direction: column; gap: 1rem; }
.pf-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.625rem; }
.pf-sub-h { margin: 0.25rem 0 -0.5rem; }
.pf-hint { margin: 0; color: var(--hp-text-2); }
.pf-link { align-self: flex-start; }
.pf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-tone-ok { background: var(--hp-ok-bg); border-color: var(--hp-ok-line); }
.pf-tone-warn { background: var(--hp-warn-bg); border-color: var(--hp-warn-line); }
.pf-tone-bad { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
.pf-chart { padding: 0.5rem; border: 1px solid var(--hp-line); border-radius: var(--hp-r-ctl); background: var(--hp-card); }
.pf-chart svg { display: block; width: 100%; height: auto; }

/* Tablas de la ficha: letra de 16/17 y filas de 52 px o más */
.pf-scroll { overflow-x: auto; border: 1px solid var(--hp-line); border-radius: var(--hp-r-ctl); }
.pf-table { font-size: var(--hp-fs-body); }
.pf-table th { padding: 0.625rem 0.75rem; font-size: var(--hp-fs-meta); font-weight: 800; }
.pf-table td { padding: 0.375rem 0.75rem; height: 3.25rem; vertical-align: middle; font-weight: 600; }
.pf-table tbody tr:last-child td { border-bottom: 0; }
.pf-what { font-weight: 700; }
.pf-what .hp-i { display: inline-block; vertical-align: -0.2em; margin-right: 0.5rem; color: var(--hp-cuero-600); }
.pf-money { font-family: var(--hp-font-num); font-weight: 800; font-variant-numeric: tabular-nums; }
.pf-dash { color: var(--hp-text-2); }
.pf-cell-note { display: block; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); }
.pf-more { color: var(--hp-cuero-700); font-size: var(--hp-fs-body); justify-content: center; gap: 0.5rem; border-top: 1px solid var(--hp-line); }

/* Raciones: cuatro tomas */
.pf-meals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
.pf-meal { padding: 0.75rem; border: 1px solid var(--hp-line); border-radius: var(--hp-r-card); background: var(--hp-cuero-50); }
.pf-meal-name { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.25rem; font-size: var(--hp-fs-strong); font-weight: 800; }
.pf-meal-name .hp-i { color: var(--hp-cuero-600); }
.pf-meal-line { margin: 0; font-size: var(--hp-fs-body); font-weight: 600; color: var(--hp-text-2); overflow-wrap: anywhere; }
.pf-meal-line b { color: var(--hp-text); font-weight: 800; }

/* Documentos */
.pf-doc-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--hp-r-ctl); background: var(--hp-cuero-100); color: var(--hp-cuero-700); }
.pf-doc .hp-row-main { cursor: default; min-height: 3.5rem; }
.pf-doc-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--hp-line); border-radius: var(--hp-r-card); background: var(--hp-cuero-50); align-items: end; }
.pf-doc-field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.pf-doc-field .hp-label { margin: 0; }
.pf-doc-up { cursor: pointer; position: relative; }
.pf-quota { margin-top: -0.25rem; }
.pf-quota > span:first-child { flex: none; }

@media (min-width: 768px) {
    .pf-layout { gap: 1.5rem; }
    .pf-main { gap: 1.25rem; }
    .pf-doc-form { grid-template-columns: 11rem minmax(0, 1fr) auto; }
}
/* Tablet y portátil pequeño: la foto a un lado de los datos en vez de enorme arriba */
@media (min-width: 768px) and (max-width: 1279px) {
    .pf-side { display: grid; grid-template-columns: 13rem minmax(0, 1fr); align-items: start; column-gap: 1.25rem; }
    .pf-photo { grid-column: 1; grid-row: 1 / span 4; aspect-ratio: 1 / 1; }
    .pf-side > :not(.pf-photo) { grid-column: 2; }
    .pf-side > .pf-facts { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); }
}
@media (min-width: 1024px) {
    .pf-meals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
    .pf-layout { grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); }
}

/* --- Montas: totales, lista de filas y panel con el recorrido --- */
.mt-horse .hp-picker-btn { width: min(100%, 18rem); margin-left: auto; }
.mt-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
.mt-stats:empty { display: none; }
.mt-chart { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0.5rem; }
.mt-chart .hp-label { margin: 0; }
.mt-bars { display: flex; gap: 0.25rem; height: 8.5rem; }
.mt-bar { flex: 1; min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) 1.5rem; justify-items: center; }
.mt-bar i { align-self: end; width: 100%; max-width: 2rem; border-radius: 0.375rem 0.375rem 0 0; background: var(--hp-cuero-600); }
.mt-bar span { align-self: end; white-space: nowrap; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); line-height: 1.5rem; }
.mt-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.mt-panel { display: none; }
.mt-metrics { display: flex; flex-direction: column; align-items: flex-end; flex: none; min-width: 5.5rem; text-align: right; }
.mt-metrics b { font-family: var(--hp-font-num); font-size: var(--hp-fs-strong); font-weight: 800; line-height: 1.2; white-space: nowrap; }
.mt-metrics span { font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); white-space: nowrap; }
.mt-row .hp-row-sub { gap: 0.375rem; }
.mt-row .hp-row-sub .hp-i { flex: none; }
.mt-detail, .mt-detail-info { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.mt-detail-head .hp-t-title { margin: 0.125rem 0 0; }
.mt-detail .hp-label { margin: 0 0 0.375rem; }
.mt-notes { display: flex; gap: 0.5rem; margin: 0; padding: 0.75rem; border-radius: var(--hp-r-ctl); background: var(--hp-cuero-50); border: 1px solid var(--hp-line); font-weight: 600; }
.mt-notes .hp-i { flex: none; color: var(--hp-cuero-600); }
.mt-del { align-self: stretch; }
.mt-map { height: 17rem; border-radius: var(--hp-r-ctl); overflow: hidden; background: var(--hp-muted); border: 1px solid var(--hp-line); }
.mt-map > .hp-empty { height: 100%; justify-content: center; padding: 1rem; }
#rides-sheet-slot .mt-detail-head { display: none; }
@media (min-width: 1024px) {
    .mt-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.8fr); }
    .mt-chart { grid-column: auto; }
    .mt-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem; }
    .mt-panel { display: block; position: sticky; top: 8.5rem; }
    .mt-panel .mt-map { height: 24rem; }
}

/* --- Calendario: celdas táctiles con chips de color e icono; el día se abre en un cajón --- */
.cal-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 1.875rem; }
.cal-summary:empty { display: none; }
.cal-card { padding: 0.75rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.375rem; }
.cal-dow { padding: 0.25rem 0; text-align: center; font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-text-2); text-transform: uppercase; letter-spacing: 0.03em; }
.cal-cell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    min-width: 0;
    min-height: 5.25rem;
    padding: 0.375rem;
    border-radius: var(--hp-r-ctl);
    border: 1px solid var(--hp-line);
    background: var(--hp-card);
    color: var(--hp-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.cal-cell:active { transform: scale(0.98); }
.cal-cell:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.cal-cell--void { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.has-late { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
.cal-cell.is-today { border: 2px solid var(--hp-cuero-600); }
.cal-cell.is-selected { box-shadow: inset 0 0 0 2px var(--hp-cuero-600); }
.cal-num { display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; min-width: 1.875rem; height: 1.875rem; padding: 0 0.25rem; border-radius: 99px; font-family: var(--hp-font-num); font-size: var(--hp-fs-body); font-weight: 800; font-variant-numeric: tabular-nums; }
.cal-cell.is-today .cal-num { background: var(--hp-cuero-600); color: #fff; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; min-width: 0; }
.cal-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 1.75rem;
    max-width: 100%;
    height: 1.75rem;
    padding: 0 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--hp-cuero-200);
    background: var(--hp-cuero-100);
    color: var(--hp-cuero-700);
    font-size: var(--hp-fs-meta);
    font-weight: 700;
    overflow: hidden;
}
.cal-chip .hp-i { width: 1.125rem; height: 1.125rem; flex: none; }
.cal-chip.is-overdue { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); color: var(--hp-bad); }
.cal-chip.is-done { background: var(--hp-ok-bg); border-color: var(--hp-ok-line); color: var(--hp-ok); }
.cal-chip-txt { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { display: inline-flex; align-items: center; height: 1.75rem; padding: 0 0.25rem; font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-text-2); }
.cal-legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }
.cal-error { grid-column: 1 / -1; }
@media (min-width: 1280px) {
    .cal-card { padding: 1rem; }
    .cal-cell { min-height: 7.5rem; }
    .cal-chips { flex-direction: column; flex-wrap: nowrap; }
    .cal-chip { justify-content: flex-start; width: 100%; }
    .cal-chip-txt { display: block; }
    .cal-more { height: auto; }
}

/* Detalle del día (cajón) */
.cal-ev-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--hp-cuero-100); color: var(--hp-cuero-700); }
.cal-ev-main { cursor: default; min-height: 3.5rem; }
.cal-ev-title { white-space: normal; }
.cal-ev-title b { font-weight: 800; }
.cal-ev.is-overdue { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
.cal-ev.is-overdue .cal-ev-ico { background: var(--hp-bad-line); color: var(--hp-bad); }
.cal-day-add { margin-top: 1rem; }

/* Cabecera de los cajones de Ficha (día del calendario y monta): mismo patrón que el alta de caballo */

/* Ajustes de Ficha: columna estrecha en portátil, botones de la foto y cifras de Montas sin estirar */
.pf-side-pair .hp-btn { padding: 0 0.5rem; gap: 0.375rem; }
.mt-stats { align-items: start; }
@media (min-width: 1280px) and (max-width: 1599px) {
    .pf-main .sal-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Fase 6: Ajustes y portal (confirmar quitar a alguien del equipo) ===== */
.hp-team-confirm { grid-column: 1 / -1; display: grid; gap: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--hp-line, rgba(0,0,0,.12)); }
.hp-team-confirm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ===== Fase 6: Ficha y Montas (botones de la foto sin partir texto, zoom del mapa al dedo) ===== */
.pf-side-pair .hp-btn { white-space: nowrap; }
@media (min-width: 1024px) and (max-width: 1599px) {
    .pf-side-pair { grid-template-columns: minmax(0, 1fr); }
}
body.hp-touch .leaflet-bar a,
body.hp-touch .leaflet-touch .leaflet-bar a { width: 48px; height: 48px; line-height: 48px; font-size: 24px; }
body.hp-touch .leaflet-control-attribution { font-size: 13px; padding: 2px 6px; }
body.hp-touch .leaflet-control-attribution a { display: inline-block; min-height: 20px; line-height: 20px; }

/* ==========================================================================
   Pendientes del rediseño (v52): casillas grandes de elección, campo de cifra,
   pantallas de entrar/registro/contraseña y menú lateral del ordenador
   ========================================================================== */

/* ---------- Formulario de campo (Apuntar, Peso, Sacos) ---------- */
.hp-form { display: flex; flex-direction: column; gap: 1rem; }
.hp-form-field { display: flex; flex-direction: column; gap: 0.375rem; }
.hp-form-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 640px) { .hp-form-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.hp-ask { display: block; margin: 0; font-size: var(--hp-fs-title); font-weight: 800; line-height: 1.2; color: var(--hp-text); }
.hp-ask small { font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); }
.hp-hint { margin: 0; font-size: var(--hp-fs-meta); font-weight: 600; line-height: 1.4; color: var(--hp-text-2); }
.hp-hint--center { text-align: center; }
.hp-input--lg { min-height: var(--hp-tap-lg); font-size: max(16px, var(--hp-fs-strong)); }
/* Cifra grande (kilos, euros, sacos): se lee al sol y se escribe con guantes */
.hp-input--fig {
    min-height: 5rem;
    text-align: center;
    font-family: var(--hp-font-num);
    font-size: var(--hp-fs-fig);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* Casillas grandes para elegir (qué apuntar, tipo de gasto, método, condición 1-9) */
.hp-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
.hp-tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hp-tiles--1 { grid-template-columns: minmax(0, 1fr); }
.hp-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    min-height: 5.5rem;
    padding: 0.625rem 0.5rem;
    border-radius: var(--hp-r-card);
    border: 2px solid var(--hp-line-strong);
    background: var(--hp-card);
    color: var(--hp-text);
    font-family: var(--hp-font);
    font-size: var(--hp-fs-body);
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s ease-out, background-color 0.15s, border-color 0.15s;
}
.hp-tile > .hp-i { width: 2rem; height: 2rem; color: var(--hp-cuero-600); }
.hp-tile:active { transform: scale(0.97); }
.hp-tile:focus-visible, .hp-tile:focus-within { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-tile--sm { min-height: var(--hp-tap-lg); }
.hp-tile b { font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 900; line-height: 1; }
.hp-tile small { font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); }
.hp-tile[aria-pressed="true"], .hp-tile.is-active, .hp-tile.is-selected {
    background: var(--hp-cuero-600);
    border-color: var(--hp-cuero-600);
    color: #fff;
}
.hp-tile[aria-pressed="true"] > .hp-i, .hp-tile.is-active > .hp-i, .hp-tile.is-selected > .hp-i,
.hp-tile[aria-pressed="true"] small, .hp-tile.is-active small, .hp-tile.is-selected small { color: #fff; }
.hp-tile--dashed { border-style: dashed; }
/* En fila: caballo a elegir, producto del almacén */
.hp-tile--row {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    min-height: var(--hp-tap-xl);
    padding: 0.5rem 1rem;
    font-size: var(--hp-fs-strong);
    text-align: left;
}
.hp-tile--row > .hp-i { width: 1.5rem; height: 1.5rem; }
.hp-tile-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-tile-aside { flex: none; font-size: var(--hp-fs-body); font-weight: 700; color: var(--hp-text-2); }
.hp-tile--bad { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); }
@media (prefers-reduced-motion: reduce) {
    .hp-tile { transition: none; }
    .hp-tile:active { transform: none; }
}

/* ---------- Entrar, registrarse y contraseña ---------- */
.hp-auth { padding: 0.5rem 0 1.5rem; }
@media (min-width: 768px) { .hp-auth { padding: 1.5rem 0 2rem; } }
.hp-auth-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    overflow: hidden;
    background: var(--hp-card);
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-r-sheet);
    box-shadow: var(--hp-sh-card);
}
.hp-auth-card--narrow { max-width: 32rem; }
@media (min-width: 1024px) { .hp-auth-card:not(.hp-auth-card--narrow) { grid-template-columns: 5fr 7fr; } }
/* Marca: en el móvil solo el logo y una frase; los puntos fuertes, desde el ordenador */
.hp-auth-brand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1.375rem;
    background: linear-gradient(135deg, var(--hp-cuero-700), var(--hp-cuero-900));
    color: #fff;
}
.hp-auth-brand .hp-logo--brand { margin: 0; }
@media (max-width: 767px) { .hp-auth-brand .hp-logo--brand { height: 3.5rem; } }
.hp-auth-brand p { margin: 0; font-size: var(--hp-fs-body); font-weight: 500; line-height: 1.45; color: rgba(255, 255, 255, 0.92); }
.hp-auth-brand h2 { margin: 0; font-family: var(--hp-font-num); font-size: var(--hp-fs-title); font-weight: 800; line-height: 1.2; color: #fff; }
.hp-auth-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0 0.75rem;
    border-radius: 999px;
    background: #fff;
    color: var(--hp-cuero-700);
    font-size: var(--hp-fs-meta);
    font-weight: 800;
}
.hp-auth-points { display: none; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.hp-auth-points li { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; font-size: var(--hp-fs-body); font-weight: 600; color: #fff; }
.hp-auth-points .hp-i { width: 1.375rem; height: 1.375rem; color: #F2D3BE; }
.hp-auth-note { display: none; margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.2); font-size: var(--hp-fs-meta); font-weight: 600; color: rgba(255, 255, 255, 0.88); }
@media (min-width: 1024px) {
    .hp-auth-brand { gap: 1rem; padding: 2.5rem; }
    .hp-auth-points { display: block; }
    .hp-auth-note { display: block; }
}
.hp-auth-main { display: flex; flex-direction: column; justify-content: center; gap: 1.25rem; padding: 1.5rem 1.25rem; }
@media (min-width: 768px) { .hp-auth-main { padding: 2rem 2.5rem; } }
@media (min-width: 1024px) { .hp-auth-main { padding: 2.5rem 3rem; } }
.hp-auth-main .hp-t-h1 { margin: 0; }
.hp-auth-main .hp-hint { margin-top: 0.25rem; font-size: var(--hp-fs-body); }
.hp-auth-form { display: flex; flex-direction: column; gap: 1rem; }
.hp-auth-form .hp-label { color: var(--hp-text); font-size: var(--hp-fs-body); }
.hp-auth-form .hp-input { min-height: var(--hp-tap-lg); }
.hp-auth-labelrow { display: flex; align-items: center; justify-content: space-between; gap: 0 0.5rem; flex-wrap: wrap; margin-bottom: 0.125rem; }
.hp-auth-labelrow .hp-label { margin: 0; }
/* Campo con icono a la izquierda y, si hace falta, un botón a la derecha (ver la contraseña) */
.hp-input-wrap { position: relative; }
.hp-input-wrap > .hp-i { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: var(--hp-text-2); pointer-events: none; }
.hp-input-wrap > .hp-input { padding-left: 3rem; }
.hp-input-wrap > .hp-input.has-end { padding-right: 3.5rem; }
.hp-input-wrap > .hp-input-end { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); }
/* Casilla «Recordarme»: 48 px de alto para el dedo */
.hp-check { display: flex; align-items: center; gap: 0.75rem; min-height: var(--hp-tap); font-size: var(--hp-fs-body); font-weight: 600; color: var(--hp-text); cursor: pointer; }
.hp-check input { flex: none; width: 1.5rem; height: 1.5rem; margin: 0; accent-color: var(--hp-cuero-600); cursor: pointer; }
/* Enlace con aspecto de texto pero 48 px de toque */
.hp-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: var(--hp-tap);
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: var(--hp-cuero-600);
    font: inherit;
    font-size: var(--hp-fs-body);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.hp-link:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; border-radius: 0.375rem; }
/* Registro guiado (v66): paso 1 «¿para qué la vas a usar?» con una opción por fila, paso 2 con los datos justos */
.hp-reg-step { display: flex; flex-direction: column; gap: 1.25rem; }
.hp-reg-step.hidden, .hp-reg-field.hidden { display: none; }
.hp-reg-step h1:focus { outline: none; }
.hp-reg-progress { margin: 0 0 0.25rem; font-size: var(--hp-fs-meta); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hp-cuero-700); }
.hp-reg-types { display: flex; flex-direction: column; gap: 0.625rem; }
.hp-reg-type, .hp-reg-chosen {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    min-height: 4.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--hp-r-card);
    border: 2px solid var(--hp-line-strong);
    background: var(--hp-card);
    color: var(--hp-text);
    font-family: var(--hp-font);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s ease-out, background-color 0.15s, border-color 0.15s;
}
.hp-reg-type:hover { border-color: var(--hp-cuero-600); background: var(--hp-cuero-50); }
.hp-reg-type:active, .hp-reg-chosen:active { transform: scale(0.98); }
.hp-reg-type:focus-visible, .hp-reg-chosen:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-reg-type > .hp-i, .hp-reg-chosen > .hp-i { flex: none; width: 2rem; height: 2rem; color: var(--hp-cuero-600); }
.hp-reg-type > .hp-reg-type-go { width: 1.25rem; height: 1.25rem; color: var(--hp-text-2); }
.hp-reg-type-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.hp-reg-type-txt b { font-size: var(--hp-fs-strong); font-weight: 800; line-height: 1.2; }
.hp-reg-type-txt small { font-size: var(--hp-fs-meta); font-weight: 600; line-height: 1.3; color: var(--hp-text-2); }
/* Lo elegido en el paso 1, con «Cambiar»: más bajo y en tono suave para que mande el formulario */
.hp-reg-chosen { min-height: var(--hp-tap-lg); padding: 0.5rem 0.875rem; border-width: 1px; border-color: var(--hp-cuero-200); background: var(--hp-cuero-50); }
.hp-reg-chosen > .hp-i { width: 1.25rem; height: 1.25rem; }
.hp-reg-chosen .hp-reg-type-txt b { font-size: var(--hp-fs-body); }
.hp-reg-field .hp-hint { margin-top: 0.375rem; font-size: var(--hp-fs-meta); }
#register-email-help { margin-top: 0.375rem; font-size: var(--hp-fs-meta); }
@media (prefers-reduced-motion: reduce) {
    .hp-reg-type, .hp-reg-chosen { transition: none; }
    .hp-reg-type:active, .hp-reg-chosen:active { transform: none; }
}
.hp-auth-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0 0.375rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--hp-line);
    font-size: var(--hp-fs-body);
    font-weight: 600;
    color: var(--hp-text-2);
    text-align: center;
}
.hp-auth-legal { margin: 0; font-size: var(--hp-fs-meta); font-weight: 600; line-height: 1.5; color: var(--hp-text-2); text-align: center; }
.hp-auth-legal a { color: var(--hp-cuero-600); font-weight: 700; text-decoration: underline; }

/* ---------- Menú lateral del ordenador (con ratón) ---------- */
.hp-sidebar { background: var(--hp-card); border-right: 1px solid var(--hp-line); }
.hp-sidebar-head { border-bottom: 1px solid var(--hp-line); }
.hp-sidebar-foot { border-top: 1px solid var(--hp-line); }
.hp-sidebar-stable {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: var(--hp-tap);
    margin-top: 0.75rem;
    padding: 0 0.75rem;
    border-radius: var(--hp-r-ctl);
    border: 1px solid var(--hp-line);
    background: var(--hp-cuero-50);
    color: var(--hp-text);
    font: inherit;
    font-size: var(--hp-fs-meta);
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}
.hp-sidebar-stable:hover { background: var(--hp-muted); }
.hp-sidebar-stable:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: 2px; }
.hp-sidebar-dot { flex: none; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--hp-ok); }
.hp-sidebar-stable > [data-hp-stable] { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-sidebar-stable > .hp-i { width: 1.125rem; height: 1.125rem; color: var(--hp-cuero-600); }
.hp-sidebar .hp-nav-group { font-size: var(--hp-fs-meta); font-weight: 800; color: var(--hp-text-2); text-transform: none; letter-spacing: 0; }
.hp-sidebar .hp-nav-btn {
    min-height: var(--hp-tap);
    padding: 0 0.75rem;
    border-radius: var(--hp-r-ctl);
    font-size: var(--hp-fs-body);
    font-weight: 700;
    color: var(--hp-text);
}
.hp-sidebar .hp-nav-btn:hover { background: var(--hp-cuero-50); }
.hp-sidebar .hp-nav-btn.is-active { background: var(--hp-cuero-100); color: var(--hp-cuero-700); font-weight: 800; box-shadow: inset 3px 0 0 var(--hp-cuero-600); }
.hp-sidebar .hp-nav-btn:focus-visible { outline: 3px solid var(--hp-cuero-600); outline-offset: -3px; }
.hp-sidebar-logout { justify-content: flex-start; color: var(--hp-bad); }
.hp-sidebar-logout:hover { background: var(--hp-bad-bg); }
.hp-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---------- Resumen de una monta (ficha rápida y portal del propietario) ---------- */
.hp-stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hp-ride-sum { display: flex; flex-direction: column; gap: 0.75rem; }
.hp-ride-sum > .hp-eyebrow { margin: 0; }
/* Aires: mismo color en la barra y en la leyenda (color + palabra + minutos) */
.hp-gait--walk { background: var(--hp-ok); }
.hp-gait--trot { background: var(--hp-warn); }
.hp-gait--canter { background: var(--hp-cuero-600); }
.hp-gait--halt { background: var(--hp-line-strong); }
.hp-gaits { display: flex; flex-direction: column; gap: 0.5rem; }
.hp-gaits-bar { display: flex; height: 0.875rem; border-radius: 99px; overflow: hidden; background: var(--hp-muted); }
.hp-gaits-bar > i { display: block; height: 100%; }
.hp-gaits-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.75rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 768px) { .hp-gaits-legend { grid-template-columns: repeat(4, max-content); } }
.hp-gaits-legend li { display: flex; align-items: center; gap: 0.5rem; min-height: 1.75rem; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); white-space: nowrap; }
.hp-gaits-legend li b { font-weight: 800; color: var(--hp-text); }
.hp-gaits-legend li > i { flex: none; width: 0.875rem; height: 0.875rem; border-radius: 50%; }
/* Recorrido dibujado (sin mapa de fondo) */
.hp-route { display: block; width: 100%; height: 11rem; border-radius: var(--hp-r-ctl); border: 1px solid var(--hp-line); background: #EEF3E8; }
@media (min-width: 768px) { .hp-route { height: 13rem; } }
.hp-route--fill { height: 100%; }
.hp-route-line { fill: none; stroke: var(--hp-cuero-600); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.hp-route-start, .hp-route-end { stroke: #fff; stroke-width: 2.5; }
.hp-route-start { fill: var(--hp-ok); }
.hp-route-end { fill: var(--hp-bad); }
.hp-route-none { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--hp-fs-meta); font-weight: 600; color: var(--hp-text-2); }

/* ---------- Ajustes en pantalla ancha (>= 1280 px): cuenta arriba, grupos en dos columnas, sesión abajo ---------- */
@media (min-width: 1280px) {
    #tab-ajustes .hp-set { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 1.5rem 2rem; }
    #tab-ajustes .hp-set-account { grid-column: 1 / -1; }
    #tab-ajustes .hp-set-session { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 18rem)); justify-content: start; padding-top: 0.5rem; border-top: 1px solid var(--hp-line); }
}

/* ---------- Cajones en el ordenador con ratón: más anchos y centrados en el contenido (no tapan el menú lateral) ---------- */
/* Una sola regla para los 29 cajones (.sheet-modal). En móvil y tablet siguen con su ancho (Tailwind max-w-lg/xl/2xl). */
@media (min-width: 1024px) {
    body.is-authed:not(.hp-touch) .sheet-modal { left: 15.5rem; }
}
@media (min-width: 1280px) {
    body:not(.hp-touch) .sheet-modal { max-width: 56rem; }
}
@media (min-width: 1600px) {
    body:not(.hp-touch) .sheet-modal { max-width: 64rem; }
}

/* Plan (ordenador): con el día, la semana o los ejercicios abiertos, el aviso «Toca un día del calendario» no se pinta detrás */
@media (min-width: 1024px) {
    .hp-plan-side:has(> .hp-plan-panel:not(.hidden)) > .hp-plan-side-empty.hp-empty { visibility: hidden; }
    #tab-plan .hp-plan-panel { background: var(--hp-card); }
}

/* ---------- Dictado por voz (js/core/dictation.js) ---------- */
/* Los botones solo se ven cuando el aparato puede dictar */
.hp-dictate { display: none; }
body.hp-can-dictate .hp-dictate { display: inline-flex; }
body.hp-can-dictate .hp-dictate.hp-btn--block { display: flex; }
.hp-dictate { flex: none; min-height: var(--hp-tap); padding: 0 0.875rem; gap: 0.375rem; font-size: var(--hp-fs-meta); }
.hp-dictate .hp-i { width: 1.25rem; height: 1.25rem; color: var(--hp-cuero-600); }
.hp-dictate.is-on { background: var(--hp-bad); border-color: var(--hp-bad); color: #fff; }
.hp-dictate.is-on .hp-i { color: #fff; }
.hp-dictate.hp-btn--lg { font-size: var(--hp-fs-strong); }
.hp-dictate.hp-btn--lg .hp-i { width: 1.5rem; height: 1.5rem; }
/* Etiqueta a la izquierda y micrófono a la derecha */
.hp-dictate-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.375rem; }
.hp-dictate-row > .hp-label, .hp-dictate-row > label { margin: 0; }
/* Aviso «Escuchando…» bajo la caja */
.hp-dictate-status { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0 0; padding: 0.625rem 0.75rem; border-radius: var(--hp-r-ctl); background: var(--hp-cuero-50); border: 1px solid var(--hp-line); font-size: var(--hp-fs-meta); font-weight: 600; line-height: 1.4; color: var(--hp-text); }
.hp-dictate-status[hidden] { display: none; }
.hp-dictate-status small { display: block; margin-top: 0.25rem; font-size: var(--hp-fs-meta); font-weight: 500; color: var(--hp-text-2); }
.hp-dictate-status.is-error { background: var(--hp-bad-bg); border-color: var(--hp-bad-line); color: var(--hp-bad); }
.hp-dictate-status > .hp-i { width: 1.25rem; height: 1.25rem; }
.hp-dictate-dot { flex: none; width: 0.75rem; height: 0.75rem; margin-top: 0.25rem; border-radius: 50%; background: var(--hp-bad); animation: hp-dictate-pulse 1.2s ease-in-out infinite; }
@keyframes hp-dictate-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .hp-dictate-dot { animation: none; } }
/* Montar: «Añadir nota» y «Dictar nota» lado a lado (si no se puede dictar, la primera ocupa todo) */
.hp-ride-notebtns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
body.hp-can-dictate .hp-ride-notebtns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* Menú lateral del ordenador (26/11/2026): con 13 opciones no cabía en un portátil de 800 px de alto y «Dinero»
   (Cobros, Gastos, Propietarios) quedaba escondido sin aviso. Es solo para ratón (en la tablet sale el riel), así que
   las filas pueden ser más bajas; en pantallas bajas se compacta más y una sombra avisa de que hay más abajo. */
@media (min-width: 1024px) {
    .hp-sidebar .hp-nav-btn { min-height: 2.5rem; }
    .hp-sidebar-scroll {
        background:
            linear-gradient(var(--hp-card) 30%, transparent) top / 100% 2rem no-repeat local,
            linear-gradient(transparent, var(--hp-card) 70%) bottom / 100% 2rem no-repeat local,
            radial-gradient(farthest-side at 50% 0, rgba(42, 19, 8, 0.14), transparent) top / 100% 0.75rem no-repeat scroll,
            radial-gradient(farthest-side at 50% 100%, rgba(42, 19, 8, 0.14), transparent) bottom / 100% 0.75rem no-repeat scroll;
    }
}
@media (min-width: 1024px) and (max-height: 900px) {
    .hp-sidebar-head { padding: 0.75rem 1rem 0.625rem; }
    .hp-logo--side { max-width: 10.75rem; }
    .hp-sidebar-stable { min-height: 2.5rem; }
    .hp-sidebar-scroll { padding: 0.5rem 0.75rem; }
    .hp-sidebar .hp-nav-group { margin: 0.625rem 0.5rem 0.25rem; }
    .hp-sidebar .hp-nav-group:first-child { margin-top: 0; }
    .hp-sidebar .hp-nav-btn { min-height: 2.25rem; }
    .hp-sidebar-foot { padding: 0.5rem 0.75rem; }
    .hp-sidebar-logout { min-height: 2.5rem; }
}
