/* Los tokens de diseño viven en theme.css (cargado antes). */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
.app-hidden { display: none !important; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: inherit; font-size: 14px; font-weight: 600; padding: 11px 20px; border-radius: 10px; border: none; cursor: pointer; color: var(--ink); transition: transform .15s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease; }
.btn:active { transform: scale(.97); }
.btn .ti { font-size: 18px; }
.btn-lg { padding: 14px 26px; font-size: 15px; width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-primary { background: var(--green-600); color: var(--on-accent); }
.btn-primary:hover { background: var(--green-700); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--muted); padding: 9px 11px; }
.btn-ghost:hover { background: var(--bg-alt); color: var(--ink); }
.icon-btn { background: transparent; border: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; font-size: 20px; display: inline-flex; }
.icon-btn:hover { background: var(--bg-alt); color: var(--ink); }
.icon-danger:hover { background: var(--pill-danger-bg); color: var(--pill-danger-text); }

input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); width: 100%; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px var(--green-50); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px; }
.login-bg { position: absolute; inset: 0; z-index: -1; background: var(--login-bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 38px 34px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.login-logo { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.login-logo b { color: var(--green-600); font-weight: 700; }
.login-card h1 { font-family: var(--font-display); font-size: 26px; letter-spacing: -.02em; margin-top: 4px; }
.login-sub { color: var(--muted); font-size: 14px; margin: -6px 0 8px; }
.login-error { color: #c0392b; font-size: 13px; font-weight: 600; min-height: 18px; text-align: center; }
.login-info { color: var(--green-700); background: var(--green-50); font-size: 13px; font-weight: 600; text-align: center; padding: 10px 12px; border-radius: 10px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.auth-switch a { color: var(--green-700); font-weight: 700; text-decoration: none; margin-left: 5px; }
.auth-switch a:hover { text-decoration: underline; }

/* topbar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.brand b { color: var(--green-600); }
.topnav { display: flex; gap: 4px; margin-left: 10px; }
.navlink { display: inline-flex; align-items: center; gap: 7px; background: transparent; border: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted); padding: 9px 14px; border-radius: 9px; }
.navlink .ti { font-size: 18px; }
.navlink:hover { background: var(--bg-alt); color: var(--ink); }
.navlink.active { background: var(--green-50); color: var(--green-700); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-email { font-size: 13px; color: var(--muted); }

/* ===== CÁSCARA / LAYOUTS ===== */
.app-shell { display: block; }
.sidebar { display: none; }
.content { min-width: 0; }
#app-view[data-layout="sidebar"] { display: flex; align-items: flex-start; }
#app-view[data-layout="sidebar"] .sidebar { display: flex; }
#app-view[data-layout="sidebar"] .topbar { display: none; }
#app-view[data-layout="sidebar"] .content { flex: 1; }
.sidebar { flex-direction: column; width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand-side { padding: 4px 8px 18px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav .navlink { width: 100%; justify-content: flex-start; padding: 11px 13px; font-size: 14px; }
.side-nav .navlink .ti { font-size: 19px; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 14px 6px 2px; }
.side-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.side-user-info { flex: 1; min-width: 0; }
.side-user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-rol { font-size: 11px; color: var(--muted); }

/* ===== DASHBOARD ===== */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.dash-date { font-size: 13px; color: var(--accent-strong); font-weight: 600; }
.dash-hi { font-family: var(--font-display); font-size: 30px; letter-spacing: -.01em; margin-top: 4px; }
.dash-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.dash-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.dash-stat .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; margin-bottom: 12px; }
.dash-stat .num { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.dash-stat .lbl { font-size: 13px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dash-panel-head h3 { font-family: var(--font-display); font-size: 16px; }
.dash-link { background: transparent; border: none; cursor: pointer; font-family: inherit; font-size: 12px; color: var(--accent); font-weight: 600; }
/* ===== Módulo Configuración ===== */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.cfg-card .cfg-title { font-family: var(--font-display); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.cfg-hint { color: var(--text-muted); font-size: 13px; margin: 6px 0 14px; }
/* Asistente de IA (MCP) */
.cfg-card-wide { grid-column: 1 / -1; }
.cfg-mcp-nuevo { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-alt); }
.cfg-mcp-warn { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--pill-warn-text); background: var(--pill-warn-bg); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.cfg-mcp-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 12px 0 6px; }
.cfg-mcp-copyrow { display: flex; align-items: flex-start; gap: 8px; }
.cfg-mcp-copyrow code, .cfg-mcp-copyrow pre { flex: 1; min-width: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; font-family: ui-monospace, monospace; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.cfg-mcp-copyrow .btn { flex-shrink: 0; }
.cfg-mcp-list { margin-top: 16px; }
.cfg-mcp-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.cfg-mcp-item-nm { font-weight: 600; font-size: 14px; }
.cfg-mcp-item-mt { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cfg-mcp-empty { margin: 8px 0 0; }

/* ===== Pestañas de Configuración ===== */
.cfg-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.cfg-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s ease, border-color .15s ease; }
.cfg-tab .ti { font-size: 17px; }
.cfg-tab:hover { color: var(--accent-strong); }
.cfg-tab.active { color: var(--accent-strong); border-bottom-color: var(--accent-strong); }
.cfg-tabpanel { animation: cfgfade .2s ease; }
@keyframes cfgfade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.flag-hidden { display: none !important; }   /* lo aplican los feature flags */

/* ===== Recordatorios ===== */
.rec-bloque { padding: 16px 0; border-top: 1px solid var(--border); }
.rec-switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.rec-switch input { width: auto; }
.rec-dias { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.rec-dias select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.rec-wa-info { margin: 10px 0; padding: 10px 12px; background: var(--bg-alt); border-radius: 10px; line-height: 1.5; }
.rec-wa-campos { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-width: 440px; }
.rec-wa-campos label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.rec-wa-campos input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.rec-marca-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; max-width: 440px; }
.rec-marca-label input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 400; }

/* ===== Plan y facturación ===== */
.cfg-plan-estado { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 4px; }
.cfg-plan-badge { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; padding: 6px 12px; border-radius: 999px; }
.cfg-plan-badge.trial { color: var(--pill-warn-text); background: var(--pill-warn-bg); }
.cfg-plan-badge.activa { color: #0a7d5a; background: #d9f3e8; }
.cfg-plan-badge.vencida { color: #9a3412; background: #fde6d8; }
.cfg-plan-msg { font-size: 14px; margin: 8px 0 0; }
.cfg-plan-msg.cfg-plan-prog { color: var(--text-muted); }
.cfg-plan-estado #cfg-plan-cancelar { margin-top: 12px; }
.cfg-plan-fam { margin-top: 16px; }
.cfg-plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; margin-top: 12px; }
.cfg-plan-card { position: relative; border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.cfg-plan-card.es-actual { border-color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent-strong); }
.cfg-plan-card.destacado { border-color: var(--accent-strong); }
.cfg-plan-ribbon { position: absolute; top: -9px; right: 12px; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; background: var(--accent-strong); color: #fff; }
.cfg-plan-nm { font-weight: 700; font-size: 15px; }
.cfg-plan-precio { font-size: 20px; font-weight: 700; }
.cfg-plan-precio span { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.cfg-plan-feats { list-style: none; margin: 8px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.cfg-plan-feats li { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.cfg-plan-feats li .ti { color: var(--accent-strong); font-size: 14px; flex-shrink: 0; }
.cfg-plan-card .btn, .cfg-plan-actual { margin-top: auto; align-self: flex-start; }
.cfg-plan-actual { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent-strong); }
.cfg-plan-upg { margin-top: 16px; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; background: var(--bg-alt); }
.cfg-plan-upg-tit { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.cfg-plan-opt { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.cfg-plan-opt .btn { align-self: flex-start; }

/* ===== Cartelito de prueba (trial) ===== */
.trial-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: var(--pill-warn-bg); color: var(--pill-warn-text); font-size: 14px; font-weight: 500; }
.trial-banner .ti { font-size: 20px; flex-shrink: 0; }
.trial-banner span { flex: 1; min-width: 180px; }
.trial-banner.urgente { background: #fde6d8; color: #9a3412; }
.trial-banner .btn { flex-shrink: 0; }

/* ===== Asistente IA (chat flotante) ===== */
.chat-fab { position: fixed; right: 22px; bottom: 22px; z-index: 95; width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; background: var(--accent-strong); color: #fff; box-shadow: 0 8px 24px rgba(6,35,28,.32); display: flex; align-items: center; justify-content: center; transition: transform .15s ease, box-shadow .15s ease; }
.chat-fab .ti { font-size: 27px; }
.chat-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 12px 30px rgba(6,35,28,.4); }
.chat-panel { position: fixed; right: 22px; bottom: 92px; z-index: 96; width: 380px; max-width: calc(100vw - 32px); height: min(620px, 78vh); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px rgba(6,35,28,.32); display: flex; flex-direction: column; overflow: hidden; }
.chat-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.chat-panel-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.chat-panel-title .ti { color: var(--accent-strong); font-size: 20px; }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.chat-bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.chat-user { align-self: flex-end; background: var(--accent-strong); color: #fff; border-bottom-right-radius: 4px; }
.chat-assistant { align-self: flex-start; background: var(--bg-alt); color: var(--ink); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px 14px 2px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; }
.chat-input .btn { flex-shrink: 0; }
.chat-hint { font-size: 11.5px; color: var(--text-muted); padding: 4px 14px 10px; text-align: center; }
.chat-prop { align-self: flex-start; max-width: 82%; background: var(--surface); border: 1px solid var(--green-100, var(--border)); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.chat-prop-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); }
.chat-prop-nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-top: 3px; }
.chat-prop-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.chat-prop-aviso { font-size: 12px; color: var(--pill-warn-text); background: var(--pill-warn-bg); border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.chat-prop-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cfg-theme { display: flex; gap: 12px; flex-wrap: wrap; }
.cfg-theme .ts-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; transition: transform .12s ease; }
.cfg-theme .ts-dot:hover { transform: scale(1.12); }
.cfg-theme .ts-dot.active { border-color: var(--text); transform: scale(1.12); }
.cfg-layout { display: flex; gap: 8px; flex-wrap: wrap; }
.cfg-layout .ls-btn { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.cfg-layout .ls-btn .ti { font-size: 16px; }
.cfg-layout .ls-btn.active { background: var(--accent-soft); border-color: var(--accent-soft2); color: var(--accent-strong); }

/* Pantalla de carga inicial (evita el parpadeo del login al recargar) */
.boot { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; background: var(--login-bg, var(--surface, #fff)); }
.boot .boot-spin { font-size: 26px; color: var(--accent); animation: bootspin .8s linear infinite; }
@keyframes bootspin { to { transform: rotate(360deg); } }
.dash-turno { display: flex; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.dash-turno:last-child { border-bottom: none; }
.dash-turno .hora { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--accent-strong); width: 52px; }
.dash-turno .av { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.dash-turno .info { flex: 1; min-width: 0; }
.dash-turno .nm { font-size: 14px; font-weight: 600; }
.dash-turno .mt { font-size: 12px; color: var(--muted); }
.dash-plano { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.dash-plano:last-child { border-bottom: none; }
.dash-plano .info { flex: 1; min-width: 0; }
.dash-plano .nm { font-size: 14px; font-weight: 600; }
.dash-plano .mt { font-size: 12px; color: var(--muted); }
.dash-empty { font-size: 13px; color: var(--muted); padding: 14px 2px; }

/* ===== selector de layout ===== */
#layout-switcher { position: fixed; bottom: 58px; left: 16px; z-index: 300; display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 30px; padding: 6px 8px 6px 12px; box-shadow: var(--shadow); font-size: 12px; color: var(--muted); }
#layout-switcher .ls-label { font-weight: 600; }
#layout-switcher .ls-btn { display: inline-flex; align-items: center; gap: 5px; font-family: inherit; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; }
#layout-switcher .ls-btn .ti { font-size: 15px; }
#layout-switcher .ls-btn.active { background: var(--accent-soft); border-color: var(--accent-soft2); color: var(--accent-strong); }

/* main / views */
.app-main { max-width: 1400px; margin: 0 auto; padding: 30px 24px 60px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.view-head h2 { font-family: var(--font-display); font-size: 26px; letter-spacing: -.01em; }
.view-sub { color: var(--muted); font-size: 14px; }

.toolbar { display: flex; gap: 12px; margin-bottom: 18px; }
.search { position: relative; flex: 1; }
.search .ti { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.search input { padding-left: 38px; }
/* Platos: el buscador a lo ancho y las categorías en su propia fila (no apretado) */
#view-platos .toolbar { flex-wrap: wrap; }
#view-platos #plato-cats { flex-basis: 100%; }

/* cards de pacientes (opción 1: avatar + métricas + próximo turno) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.paciente-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease; }
.paciente-card:hover { box-shadow: var(--shadow); border-color: var(--accent-soft2); transform: translateY(-1px); }
.card-edit { position: absolute; top: 12px; right: 12px; color: var(--muted); font-size: 16px; opacity: 0; transition: opacity .15s ease; }
.paciente-card:hover .card-edit { opacity: 1; }
.pac-top { display: flex; align-items: center; gap: 12px; }
.pac-top > div:not(.avatar) { flex: 1; min-width: 0; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 16px; text-transform: uppercase; flex-shrink: 0; }
.paciente-card h4 { font-family: var(--font-display); font-size: 16px; line-height: 1.2; }
.card-sub { font-size: 12.5px; color: var(--accent-strong); font-weight: 600; margin-top: 3px; }
.pac-stats { display: flex; gap: 9px; margin-top: 14px; }
.pac-stat { flex: 1; background: var(--bg-alt); border-radius: 10px; padding: 9px 11px; }
.pac-stat b { display: block; font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1; color: var(--text); }
.pac-stat span { display: block; font-size: 10px; color: var(--text-muted); margin-top: 3px; letter-spacing: .03em; text-transform: uppercase; }
.pac-stat.imc-normal { background: var(--accent-soft); }
.pac-stat.imc-normal b, .pac-stat.imc-normal span { color: var(--accent-strong); }
.pac-stat.imc-alto { background: var(--pill-warn-bg); }
.pac-stat.imc-alto b, .pac-stat.imc-alto span { color: var(--pill-warn-text); }
.pac-next { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); }
.pac-next .ti { font-size: 15px; color: var(--accent-strong); }
.pac-next b { color: var(--text); font-weight: 600; }
/* (legado: clases de la tarjeta anterior, se conservan por compatibilidad) */
.card-obj { font-size: 13px; color: var(--muted); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-contact { font-size: 13px; color: var(--muted); margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.card-contact span { display: flex; align-items: center; gap: 6px; }

/* turnos */
.turnos-list { display: flex; flex-direction: column; gap: 10px; }
.turno-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; display: flex; align-items: center; gap: 18px; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.turno-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--green-100); }
.turno-fecha { font-size: 13px; font-weight: 600; color: var(--green-700); display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 190px; }
.turno-main { flex: 1; min-width: 0; }
.turno-paciente { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.turno-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.turno-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.turno-wa { color: #25d366; }
.turno-wa:hover { background: rgba(37, 211, 102, .14); color: #1da851; }

/* pills de estado */
.pill { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 20px; white-space: nowrap; }
.pill-pendiente { background: var(--pill-info-bg); color: var(--pill-info-text); }
.pill-realizado { background: var(--pill-ok-bg); color: var(--pill-ok-text); }
.pill-cancelado { background: var(--pill-danger-bg); color: var(--pill-danger-text); }
.pill-ausente { background: var(--pill-warn-bg); color: var(--pill-warn-text); }

/* toggle Calendario / Lista */
.seg { display: inline-flex; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 99px; padding: 3px; gap: 2px; }
.seg-btn { background: transparent; border: none; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; transition: background .15s ease, color .15s ease; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow); }

/* calendario mensual */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h3 { font-family: var(--font-display); font-size: 19px; text-transform: capitalize; min-width: 170px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding-bottom: 4px; }
.cal-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-height: 92px; min-width: 0; overflow: hidden; padding: 7px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s ease, box-shadow .15s ease; }
.cal-cell:hover { border-color: var(--green-100); box-shadow: var(--shadow); }
.cal-cell.cal-empty { background: transparent; border-color: transparent; cursor: default; box-shadow: none; }
.cal-cell.cal-empty:hover { box-shadow: none; }
.cal-cell.cal-sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-cell .cal-num { font-size: 13px; font-weight: 600; color: var(--ink); align-self: flex-start; line-height: 22px; min-width: 22px; height: 22px; text-align: center; border-radius: 50%; }
.cal-cell.cal-today .cal-num { background: var(--accent); color: #fff; }
.cal-ev { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; background: var(--pill-info-bg); color: var(--pill-info-text); }
.cal-ev.ev-realizado { background: var(--pill-ok-bg); color: var(--pill-ok-text); }
.cal-ev.ev-cancelado { background: var(--pill-danger-bg); color: var(--pill-danger-text); }
.cal-ev.ev-ausente { background: var(--pill-warn-bg); color: var(--pill-warn-text); }
.cal-more { font-size: 11px; color: var(--muted); font-weight: 600; }
.cal-dia-titulo { font-family: var(--font-display); font-size: 16px; margin: 24px 0 12px; text-transform: capitalize; }
.cal-dia-empty { padding: 30px 20px; }

@media (max-width: 640px) {
  .cal-grid { gap: 4px; }
  .cal-cell { min-height: 64px; padding: 5px 4px; }
  .cal-nav h3 { min-width: 120px; font-size: 16px; }
  .cal-ev { font-size: 10px; padding: 1px 4px; }
  .cal-cell .cal-num { font-size: 12px; min-width: 20px; height: 20px; line-height: 20px; }
}

/* ===== PLATOS ===== */
.cat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: inherit; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 99px; border: 1.5px solid var(--border); cursor: pointer; background: var(--surface); color: var(--text-muted); transition: border-color .15s ease, color .15s ease, background .15s ease; }
.chip:hover { border-color: var(--accent-soft2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-soft2); color: var(--accent-strong); }
/* paleta de macros (proteína / carbohidratos / grasas) — tonos naturales, sin neón */
:root { --m-prot: #3f6051; --m-carb: #c79a3e; --m-gras: #b5775a; }

.platos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

/* ---- Tarjeta de plato (opción C: anillo de macros + datos al costado) ---- */
.plato-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 15px; cursor: pointer; display: flex; align-items: center; gap: 15px; transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease; }
.plato-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--accent-soft2); }

/* anillo de macros con las kcal al centro (el conic-gradient lo arma el JS por tarjeta) */
.pc-ring { position: relative; width: 66px; height: 66px; border-radius: 50%; flex-shrink: 0; background: conic-gradient(var(--m-prot) 0 33%, var(--m-carb) 33% 66%, var(--m-gras) 66% 100%); }
.pc-ring.is-empty { background: var(--accent-soft); }
.pc-ring-in { position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pc-ring-in b { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1; color: var(--text); }
.pc-ring-in span { font-size: 7.5px; letter-spacing: .1em; color: var(--text-muted); margin-top: 2px; }

.pc-body { min-width: 0; flex: 1; }
.pc-cat { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-strong); }
.pc-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
/* fila categoría + origen (usada en Alimentos: Base / Mío) */
.pc-cat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-origen { font-size: 9.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--bg-alt); color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.pc-origen.is-mio { background: var(--accent-soft); color: var(--accent-strong); }
.pc-macros { display: flex; gap: 12px; margin-top: 9px; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pc-macros span { display: inline-flex; align-items: center; gap: 5px; }
.pc-macros i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.pc-macros b { color: var(--text); font-weight: 700; }
.pc-macros.is-empty { font-style: italic; opacity: .7; }

/* (legado: clases de la tarjeta anterior, se conservan por compatibilidad con otras vistas) */
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cat-badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; }
.pc-kcal { text-align: right; line-height: 1; }
.pc-kcal b { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.pc-kcal span { display: block; font-size: 10px; color: var(--text-muted); letter-spacing: .05em; }
.plato-card h4 { font-family: var(--font-display); font-size: 14.5px; line-height: 1.25; margin: 6px 0 0; color: var(--text); text-wrap: pretty; }
.pc-porcion { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.macro-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--accent-soft); margin-top: 14px; }
.macro-bar span { min-width: 0; height: 100%; }
.macro-line { font-size: 12px; color: var(--text-muted); margin-top: 7px; font-variant-numeric: tabular-nums; }
.pl-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.macros-row label { flex: 1; }
.cat-neutral { background: var(--accent-soft); color: var(--accent-strong); }
.nutri-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 14px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.nutri-title span { font-size: 11px; color: var(--muted); font-weight: 600; background: var(--accent-soft); padding: 2px 9px; border-radius: 20px; }

/* ===== ALIMENTOS (catálogo USDA + alta manual) ===== */
.al-filter { width: auto; min-width: 200px; flex-shrink: 0; }
.al-subbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.al-count { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.al-origen { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 9px; border-radius: 99px; margin-top: 10px; }
.al-usda { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.al-mio { background: var(--accent-soft); color: var(--accent-strong); }
.al-origen .ti { font-size: 13px; }
.macro-line-empty { font-style: italic; opacity: .7; margin-top: 14px; }
.al-hint { font-size: 12px; color: var(--text-muted); margin: -4px 0 2px; }
.al-base-row { flex-direction: row; align-items: center; gap: 9px; background: var(--accent-soft); border: 1px solid var(--accent-soft2); border-radius: 10px; padding: 11px 13px; color: var(--accent-strong); font-weight: 600; cursor: pointer; }
.al-base-row input { width: auto; cursor: pointer; }

/* campos de nutrientes generados desde el catálogo */
.nd-sec { margin-top: 10px; }
.nd-sec-t { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); margin-bottom: 8px; }
.nd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.nd-field { font-size: 12px; }
.nd-field small { color: var(--text-muted); font-weight: 500; }
.nd-field input { padding: 8px 10px; }
#al-nutri-extra { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px; }

/* detalle de alimento (solo lectura) */
.fd-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fd-meta .al-origen, .fd-meta .fd-porcion { margin-top: 0; }
.fd-porcion { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.fd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fd-tabla { display: flex; flex-direction: column; gap: 16px; }
.fd-grupo h4 { font-family: var(--font-display); font-size: 14px; color: var(--accent-strong); margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.fd-row { display: flex; justify-content: space-between; gap: 14px; padding: 6px 2px; font-size: 14px; border-bottom: 1px solid var(--bg-alt); }
.fd-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fd-fuente { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.fd-loading { font-size: 13px; color: var(--text-muted); padding: 16px 2px; }

/* ===== PLATOS — composición con alimentos ===== */
.ing-search { position: relative; }
.ing-search > .ti { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.ing-search input { padding-left: 38px; }
.ing-results { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.ing-opt { text-align: left; background: transparent; border: none; cursor: pointer; font-family: inherit; font-size: 14px; color: var(--text); padding: 9px 11px; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.ing-opt:hover { background: var(--accent-soft); color: var(--accent-strong); }
.ing-mio { font-size: 10px; font-weight: 700; background: var(--accent-soft); color: var(--accent-strong); padding: 2px 7px; border-radius: 99px; }
.ing-noresult { font-size: 13px; color: var(--text-muted); padding: 10px 11px; }
.ing-list { display: flex; flex-direction: column; gap: 6px; }
.ing-list:not(:empty) { margin-top: 4px; }
.ing-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.ing-nombre { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ing-gramos { width: 72px; flex-shrink: 0; padding: 6px 8px; text-align: right; }
.ing-unit { font-size: 13px; color: var(--text-muted); margin-left: -4px; }
.ing-kcal { font-size: 12px; color: var(--text-muted); width: 72px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ing-del { flex-shrink: 0; }
.ing-totales { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; margin-top: 4px; }
.tot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tot-kcal { font-size: 14px; color: var(--accent-strong); }
.tot-kcal b { font-family: var(--font-display); font-size: 24px; }
.tot-peso { font-size: 12px; color: var(--text-muted); }
.ing-totales .macro-bar { margin-top: 10px; }
.tot-macros { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.macros-manual { border: 1px dashed var(--border); border-radius: 10px; padding: 4px 12px; }
.macros-manual summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 8px 0; }
.macros-manual .macros-row { padding-bottom: 10px; }

/* empty */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ti { font-size: 52px; color: var(--green-100); }
.empty p { margin: 12px 0 18px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6, 35, 28, .45); backdrop-filter: blur(2px); }
.modal-panel { position: relative; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 680px; max-height: 92vh; max-height: 92dvh; overflow: auto; }
/* Modales con más contenido (alimento, plato): ventana más ancha en desktop */
@media (min-width: 641px) { .modal-panel.modal-wide { max-width: 900px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { font-family: var(--font-display); font-size: 18px; }
.head-actions { display: flex; align-items: center; gap: 2px; }
.form-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.form-body .btn { margin-top: 4px; }
.field-row { display: flex; gap: 12px; }
.field-row .grow { flex: 1; }
.field-row > label { flex: 1; min-width: 0; }

/* ===== Mediciones / progreso (dentro de la ficha del paciente) ===== */
.med-section { padding: 20px 22px 24px; border-top: 1px solid var(--border); }
.med-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.med-head h4 { font-family: var(--font-display); font-size: 16px; display: flex; align-items: center; gap: 7px; }
.med-now { display: flex; gap: 10px; }
.med-stat { background: var(--accent-soft); color: var(--accent-strong); border-radius: 12px; padding: 6px 14px; text-align: center; line-height: 1.15; }
.med-stat b { font-family: var(--font-display); font-size: 17px; display: block; }
.med-stat small { font-size: 11px; opacity: .8; }
.med-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.med-row { display: flex; align-items: center; gap: 12px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.med-row .med-fecha { font-size: 13px; font-weight: 600; color: var(--green-700); white-space: nowrap; min-width: 92px; }
.med-row .med-vals { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.med-chip { font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.med-chip.med-chip-peso { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.med-del { background: transparent; border: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 8px; font-size: 16px; flex-shrink: 0; }
.med-del:hover { background: var(--pill-danger-bg); color: var(--pill-danger-text); }

/* ===== PACIENTES — ficha completa ===== */
.fd-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.fd-cab { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.fd-avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 22px; text-transform: uppercase; flex-shrink: 0; }
.fd-cab-info { flex: 1; min-width: 0; }
.fd-cab-info h2 { font-family: var(--font-display); font-size: 24px; line-height: 1.15; }
.fd-cab-sub { font-size: 14px; color: var(--text-muted); margin-top: 3px; }
.fd-cab-stats { display: flex; gap: 22px; }
.fd-stat { text-align: center; }
.fd-stat b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--accent-strong); }
.fd-stat small { font-size: 11px; color: var(--text-muted); }
/* dial de progreso (ficha — opción 1): peso al centro, anillo = % a la meta */
.fd-dial { text-align: center; flex-shrink: 0; }
.fd-dial-ring { position: relative; width: 78px; height: 78px; border-radius: 50%; margin: 0 auto; background: var(--bg-alt); }
.fd-dial-in { position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.fd-dial-in b { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1; color: var(--text); }
.fd-dial-in span { font-size: 9px; color: var(--text-muted); margin-top: 1px; }
.fd-dial-cap { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; }
.fd-fija { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 14px; }
.fd-dato { background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.fd-dato.fd-wide { grid-column: 1 / -1; }
.fd-dato span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.fd-dato b { font-size: 14px; font-weight: 600; color: var(--text); white-space: pre-wrap; }
.fd-tabs { display: flex; gap: 4px; margin: 22px 0 16px; border-bottom: 2px solid var(--border); }
.fd-tab { display: inline-flex; align-items: center; gap: 7px; background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text-muted); padding: 11px 16px; }
.fd-tab:hover { color: var(--text); }
.fd-tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.fd-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.fd-form h4 { font-family: var(--font-display); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.fd-hint { font-size: 11px; font-weight: 500; color: var(--text-muted); background: var(--bg-alt); padding: 2px 9px; border-radius: 20px; }
.fd-consultas { display: flex; flex-direction: column; gap: 10px; }
.fd-consulta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.fd-c-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fd-c-fecha { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--accent-strong); display: flex; align-items: center; gap: 6px; }
.fd-c-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fd-c-nota { font-size: 13.5px; color: var(--text); margin-top: 8px; }
.fd-c-nota b { color: var(--text-muted); font-weight: 600; }
.fd-soon { text-align: center; padding: 40px 20px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.fd-soon .ti { font-size: 36px; color: var(--green-100); display: block; margin-bottom: 8px; }

/* Editor de texto con formato (notas) */
.rich-field { display: flex; flex-direction: column; gap: 6px; }
.rich-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.rich { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.rich-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rich-b { border: 1px solid transparent; background: transparent; cursor: pointer; min-width: 28px; height: 28px; border-radius: 8px; font-size: 14px; line-height: 1; color: var(--text); display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.rich-b:hover { background: var(--accent-soft); border-color: var(--border); }
.rich-sw { font-size: 17px; padding: 0; min-width: 24px; }
.rich-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rich-edit { min-height: 130px; max-height: 320px; overflow-y: auto; padding: 12px 14px; outline: none; font: inherit; color: var(--text); line-height: 1.6; }
.rich-edit:empty::before { content: attr(data-ph); color: var(--text-muted); pointer-events: none; }
/* Quill (tema snow) integrado con el tema de la app */
.rich-host .ql-toolbar.ql-snow,
.rich-host .ql-container.ql-snow { border-color: var(--border); }
.rich-host .ql-toolbar.ql-snow { border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); }
.rich-host .ql-container.ql-snow { border-radius: 0 0 var(--radius) var(--radius); font: inherit; }
.rich-host .ql-editor { min-height: 130px; max-height: 320px; font-size: 14px; color: var(--text); line-height: 1.6; }
.rich-host .ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }
/* listas de las notas al MOSTRARLAS (fuera del editor Quill) */
.fd-c-nota ol, .fd-dato ol { margin: 4px 0 0; padding-left: 1.5em; }
.fd-c-nota li[data-list="bullet"], .fd-dato li[data-list="bullet"] { list-style: disc; }
/* Planes en el portón (suscripción Mercado Pago) */
.gate-planes { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 6px 0 2px; }
.gate-plan { flex-direction: column; align-items: center; gap: 2px; height: auto; padding: 10px 12px; line-height: 1.25; }
.gate-plan small { font-weight: 500; opacity: .85; font-size: 12px; }
/* planes asignados (Fase B) */
.fd-asignados { display: flex; flex-direction: column; gap: 10px; }
.asig-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.asig-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.asig-main { min-width: 0; }
.asig-titulo { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.asig-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.asig-actions { display: flex; gap: 2px; flex-shrink: 0; }
.asig-detalle { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.asig-actual { background: var(--surface); border: 1.5px solid var(--accent-soft2); border-radius: var(--radius); padding: 16px 18px; }
.asig-actual-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.asig-badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); background: var(--accent-soft); padding: 2px 9px; border-radius: 99px; margin-bottom: 6px; }
.asig-detalle-full { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.asig-meal { margin-bottom: 12px; }
.asig-meal-t { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--accent-strong); display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.asig-op { font-size: 13.5px; padding: 3px 0 3px 24px; }
.asig-op b { color: var(--text-muted); font-weight: 600; }
.asig-day { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.asig-day-t { background: var(--bg-alt); padding: 6px 12px; font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.asig-row { display: flex; gap: 10px; padding: 5px 12px; border-top: 1px solid var(--bg-alt); font-size: 13.5px; }
.asig-row-m { width: 90px; color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.est-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.est-ico { font-size: 28px; color: var(--accent-strong); flex-shrink: 0; }
.est-info { min-width: 0; }
/* visor de estudios (PDF / imagen) */
.visor-panel { position: relative; background: var(--surface); border-radius: 14px; width: 100%; max-width: 1000px; height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.visor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.visor-nombre { font-family: var(--font-display); font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor-body { flex: 1; min-height: 0; background: var(--bg-alt); display: flex; }
.visor-body iframe { width: 100%; height: 100%; border: none; }
.visor-body img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
/* antropometría */
.an-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.an-fecha { width: auto; }
.an-grupo { margin-bottom: 12px; }
.an-acciones { display: flex; gap: 10px; flex-wrap: wrap; }
.an-resultados { background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.an-res-t, .an-hist-t { font-family: var(--font-display); font-size: 15px; display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; }
.an-res-t { margin-top: 0; }
.an-res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.an-res { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.an-res-lbl { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.an-res-val { font-family: var(--font-display); font-size: 18px; color: var(--accent-strong); }
.an-res-cl { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.an-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.an-vista-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.an-vista-fecha { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--accent-strong); display: flex; align-items: center; gap: 6px; }
.an-3d-wrap { margin: 18px 0; }
.an-3d-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.an-3d-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; }
.an-3d { flex: 1; min-width: 280px; height: 400px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; }
.an-3d canvas { display: block; }
.an-3d-legend { width: 210px; display: flex; flex-direction: column; gap: 6px; }
.an-leg { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px; }
.an-leg b { font-variant-numeric: tabular-nums; color: var(--accent-strong); }
@media (max-width: 720px) { .an-3d-legend { width: 100%; } }
@media (max-width: 720px) {
  .fd-cab { flex-wrap: wrap; gap: 12px 14px; }
  .fd-cab-info { flex-basis: calc(100% - 74px); }       /* avatar + nombre en la 1ª fila */
  .fd-cab-info h2 { font-size: 20px; }
  .fd-cab-stats { flex-basis: 100%; justify-content: flex-start; gap: 30px;
    padding-top: 12px; border-top: 1px solid var(--border); }  /* peso/IMC en su propia fila */
  .fd-fija { grid-template-columns: 1fr 1fr; }
  .fd-tabs { overflow-x: auto; }
}
.med-empty { font-size: 13px; color: var(--muted); padding: 14px 0 18px; }
.med-add { background: var(--bg-alt); border: 1px dashed var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.med-add .field-row { gap: 10px; }
.med-add label { font-size: 12px; }
.med-add .btn { align-self: flex-start; }
@media (max-width: 560px) {
  .med-now { width: 100%; }
  .med-stat { flex: 1; }
  .med-add .btn { align-self: stretch; justify-content: center; }
  .med-row { flex-wrap: wrap; gap: 8px 12px; }
}

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--toast-bg); color: var(--toast-text); padding: 12px 22px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s ease; z-index: 200; display: flex; align-items: center; gap: 9px; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast .ti { color: var(--green-100); font-size: 19px; }

/* botones extra */
.btn-outline { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); }
.btn-link { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: none; cursor: pointer; color: var(--text-muted); font-family: inherit; font-size: 14px; font-weight: 600; padding: 6px 4px; }
.btn-link:hover { color: var(--text); }
.head-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== PLANES — lista ===== */
.planes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.plan-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--accent-soft2); }
.plan-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plan-nombre { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.25; }
.pill-mini { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.pill-mini.pill-ok { background: var(--pill-ok-bg); color: var(--pill-ok-text); }
.pill-mini.pill-warn { background: var(--pill-warn-bg); color: var(--pill-warn-text); }
.pill-mini.pill-info { background: var(--pill-info-bg); color: var(--pill-info-text); }
.plan-pac { display: flex; align-items: center; gap: 7px; font-size: 14px; margin-top: 10px; }
.plan-pac .ti { color: var(--text-muted); }
.plan-obj { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.plan-foot { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.plan-foot span, .plan-vig { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.plan-vig { margin-top: 8px; }
.plan-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.plan-dup { font-size: 17px; padding: 4px; }
.builder-hint { font-size: 12.5px; color: var(--text-muted); margin: -2px 0 12px; line-height: 1.45; }

/* ===== PLANES — armador ===== */
.builder-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.builder-bar-actions { margin-left: auto; display: flex; gap: 10px; }
.builder-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.builder-left { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel-title { font-family: var(--font-display); font-size: 18px; margin-bottom: 16px; }
.builder-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.estructura-toggle { display: flex; align-items: center; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.estructura-toggle > span { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.toggle-group { display: inline-flex; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; gap: 4px; }
.tg-btn { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; border: none; cursor: pointer; background: transparent; color: var(--text-muted); }
.tg-btn.active { background: var(--accent); color: var(--on-accent); }

.meals-col { display: flex; flex-direction: column; gap: 14px; }
.meal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.meal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.meal-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 18px; }
.meal-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.meal-info { font-size: 12px; color: var(--text-muted); }
.add-opt { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 9px; border: 1.5px dashed var(--border); cursor: pointer; background: transparent; color: var(--accent); }
.add-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.opt-n { width: 24px; height: 24px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--accent-strong); flex-shrink: 0; }
.opt-main { flex: 1; min-width: 0; }
.opt-nombre { font-size: 14px; font-weight: 600; line-height: 1.2; }
.opt-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.opt-del:hover { background: var(--pill-danger-bg); color: var(--pill-danger-text); }

.week-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.week-grid { min-width: 880px; }
.week-row { display: grid; grid-template-columns: 120px 1fr; border-bottom: 1px solid var(--border); }
.week-day { padding: 14px; border-right: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.wd-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.wd-total { font-size: 12px; color: var(--accent-strong); font-weight: 600; }
.week-cells { display: grid; grid-template-columns: repeat(5, 1fr); }
.week-cell { padding: 8px; border-right: 1px solid var(--border); min-height: 80px; display: flex; flex-direction: column; gap: 5px; }
.week-meal { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.week-plato { display: flex; align-items: flex-start; gap: 4px; font-size: 11px; line-height: 1.25; background: var(--accent-soft); color: var(--accent-strong); padding: 4px 6px; border-radius: 6px; }
.week-plato span { flex: 1; min-width: 0; }
.week-plato button { background: transparent; border: none; cursor: pointer; color: inherit; padding: 0; font-size: 12px; opacity: .6; display: inline-flex; }
.wk-add { font-family: inherit; font-size: 11px; font-weight: 600; padding: 3px; border-radius: 6px; border: 1px dashed var(--border); cursor: pointer; background: transparent; color: var(--text-muted); margin-top: auto; }
.wk-add:hover { border-color: var(--accent); color: var(--accent); }
.indic-panel { margin-top: 16px; }
.indic-title { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 15px; font-family: var(--font-display); margin-bottom: 8px; }

/* sidebar resumen */
.builder-side { position: sticky; top: 80px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.side-kicker { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.side-estr { font-size: 12px; color: var(--text-muted); margin: 4px 0 16px; }
.side-kcal { display: flex; align-items: baseline; gap: 8px; }
.side-kcal b { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1; }
.side-kcal span { font-size: 13px; color: var(--text-muted); }
.side-prog { height: 8px; border-radius: 99px; background: var(--bg); margin: 12px 0 6px; overflow: hidden; }
.side-prog div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.side-pct { font-size: 12px; color: var(--text-muted); }
.side-sep { height: 1px; background: var(--border); margin: 18px 0; }
.side-label { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.side-macrobar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--bg); margin-bottom: 12px; }
.side-macrobar span { min-width: 0; }
.side-macros { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side-macros div { display: flex; align-items: center; gap: 8px; }
.side-macros .dot { width: 10px; height: 10px; border-radius: 3px; }
.side-macros b { margin-left: auto; font-variant-numeric: tabular-nums; }
.side-export { margin-top: 18px; width: 100%; }

/* picker */
.picker-panel { max-width: 520px; max-height: 80vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.picker-head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.picker-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.picker-top h3 { font-family: var(--font-display); font-size: 17px; }
.picker-list { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.pick-item { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; background: var(--surface); }
.pick-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.pick-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.pick-main { flex: 1; min-width: 0; }
.pick-nombre { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; }
.pick-meta { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pick-item > .ti { color: var(--accent); font-size: 18px; }

/* ===== HOJA PDF del plan ===== */
#plan-print { display: none; }
.pp-sheet { font-family: 'Inter', system-ui, sans-serif; color: #16201d; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pp-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #0f6e56; padding-bottom: 14px; margin-bottom: 18px; }
.pp-title { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.pp-sub { font-size: 13px; color: #5c6b66; margin-top: 4px; }
.pp-brand { text-align: right; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 14px; }
.pp-meal { break-inside: avoid; margin-bottom: 14px; }
.pp-meal-t { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; color: #0f6e56; border-bottom: 1px solid #e3eae7; padding-bottom: 5px; margin-bottom: 8px; }
.pp-op { font-size: 13px; padding: 4px 0; }
.pp-op span { color: #5c6b66; }
.pp-empty { font-size: 13px; color: #9aa6a1; font-style: italic; }
.pp-day { break-inside: avoid; border: 1px solid #e3eae7; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.pp-day-h { display: flex; justify-content: space-between; background: #f4f8f6; padding: 7px 12px; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 14px; }
.pp-row { display: flex; gap: 10px; padding: 6px 12px; border-top: 1px solid #eef2f0; font-size: 13px; }
.pp-meal-n { width: 90px; color: #5c6b66; font-weight: 600; flex-shrink: 0; }
.pp-indic { margin-top: 20px; padding: 14px 16px; background: #f4f8f6; border-radius: 8px; break-inside: avoid; }
.pp-indic-t { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.pp-indic div { font-size: 13px; color: #3a4642; line-height: 1.5; white-space: pre-wrap; }
.pp-foot { margin-top: 24px; padding-top: 12px; border-top: 1px solid #e3eae7; display: flex; justify-content: space-between; font-size: 12px; color: #5c6b66; }
/* informe antropométrico */
.an-pdf-cols { display: flex; gap: 18px; align-items: flex-start; margin-top: 8px; }
.an-pdf-mapa { width: 270px; flex: none; }
.an-pdf-res { flex: 1; }
.an-pdf-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-pdf-tabla td { padding: 5px 6px; border-bottom: 1px solid #e3eae7; color: #16201d; }
.an-pdf-v { white-space: nowrap; }
.an-pdf-c { color: #5c6b66; }
.an-pdf-mg { break-inside: avoid; margin-bottom: 8px; }
.an-pdf-mt { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 13px; color: #0f6e56; margin-bottom: 3px; }
.an-pdf-mi { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.an-pdf-med { font-size: 12.5px; color: #3a4642; }
@media print {
  body > *:not(#plan-print) { display: none !important; }
  #plan-print { display: block; }
  @page { size: A4; margin: 14mm; }
}

/* Barra de navegación inferior (solo celular; se muestra en el @media de abajo) */
.mobnav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 2px; }
.mobnav-link { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer; font-family: inherit; font-size: 10px; font-weight: 600;
  color: var(--text-muted); padding: 5px 2px; border-radius: 10px; min-width: 0; }
.mobnav-link .ti { font-size: 21px; }
.mobnav-link.active { color: var(--accent-strong); }

/* Botón flotante de agregar (FAB) — solo celular; se muestra en el @media de abajo */
.fab { display: none; }

/* responsive */
@media (max-width: 920px) {
  .builder-grid { grid-template-columns: 1fr; }
  .builder-side { position: static; }
}
@media (max-width: 720px) {
  /* en celular siempre barra arriba (la lateral no entra) */
  #app-view[data-layout="sidebar"] { display: block; }
  #app-view[data-layout="sidebar"] .sidebar { display: none; }
  #app-view[data-layout="sidebar"] .topbar { display: block; }
  #layout-switcher { display: none; }
  .topbar-inner { gap: 8px; padding: 0 12px; }
  .brand { font-size: 16px; }
  .topnav { display: none; }            /* la navegación pasa a la barra inferior */
  .user-email { display: none; }
  .mobnav { display: flex; }            /* aparece la barra inferior */
  .app-main { padding-bottom: 78px; }   /* aire para que la barra no tape el contenido */
  /* En celular: el "+" va a la IZQUIERDA y el chat a la DERECHA (no se pisan) */
  .fab { display: flex; align-items: center; justify-content: center; position: fixed;
    left: 16px; right: auto; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 85;
    width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(6, 35, 28, .28); }
  .fab .ti { font-size: 26px; }
  .chat-fab { right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  .chat-fab .ti { font-size: 24px; }
  .chat-panel { right: 0; left: 0; top: 0; bottom: 0; width: 100%; max-width: none; height: 100dvh; border-radius: 0; border: none; z-index: 130; }
  /* en celular el "+" flotante reemplaza al botón de arriba (no duplicar) */
  #nuevo-paciente, #nuevo-turno, #nuevo-alimento, #nuevo-plato { display: none; }
  .builder-fields { grid-template-columns: 1fr; }
  .builder-bar { flex-wrap: wrap; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .view-head, .dash-head { flex-direction: column; align-items: stretch; }
  .field-row { flex-direction: column; }
  /* turno: la fecha/hora arriba; abajo el nombre + el estado (sin aplastarse) */
  .turno-row { flex-wrap: wrap; gap: 6px 12px; padding: 14px 16px; }
  .turno-fecha { flex-basis: 100%; min-width: 0; }
  .turno-main { flex: 1; min-width: 0; }
  .turno-row .pill { flex-shrink: 0; }
  /* stats de Inicio: ícono a la izquierda + número/etiqueta a la derecha (compacto, no sparse) */
  .dash-stats { grid-template-columns: 1fr; }
  .dash-stat { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; padding: 14px 16px; }
  .dash-stat .ico { margin-bottom: 0; grid-row: 1 / span 2; }
  .dash-stat .num { font-size: 22px; line-height: 1.1; align-self: end; }
  .dash-stat .lbl { align-self: start; }
}

/* En celular, los modales van a PANTALLA COMPLETA (más espacio, sin recortes).
   Se usa dvh para no cortar contenido con la barra del navegador móvil. */
@media (max-width: 640px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-panel {
    width: 100%; max-width: none;
    height: 100vh; height: 100dvh;
    max-height: 100vh; max-height: 100dvh;
    border-radius: 0;
  }
  .modal-head { padding: 14px 16px; }
  .form-body { padding: 16px; }
  .field-row { flex-direction: column; }
  /* visor de estudios (PDF/imagen) también a pantalla completa */
  .visor-panel { max-width: none; height: 100vh; height: 100dvh; border-radius: 0; }
  /* pestañas de la ficha: 4 columnas que entran (ícono arriba + texto), sin scroll lateral */
  .fd-tabs { gap: 2px; overflow: visible; }
  .fd-tab { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; text-align: center;
    font-size: 10px; line-height: 1.15; padding: 8px 2px; }
  .fd-tab .ti { font-size: 19px; }
}
