/* SOMOS Historia Clínica – interfaz del frontend (todo dentro de .sh-app) */
.sh-app {
	--sh-naranja: #e4613d;
	--sh-naranja-osc: #c94f2d;
	--sh-turquesa: #3f9aa5;
	--sh-turquesa-osc: #2f7d87;
	--sh-fondo: #f6f3ee;
	--sh-tarjeta: #ffffff;
	--sh-borde: #e3ddd3;
	--sh-texto: #2a2f33;
	--sh-suave: #6a7177;
	--sh-ok: #2f7d5b;
	--sh-error: #b32d2e;

	box-sizing: border-box;
	width: 100%;
	max-width: 1360px;
	margin: 0 auto;
	padding: 16px;
	color: var(--sh-texto);
	font-size: 16px;
	line-height: 1.5;
}
body.sh-body { margin: 0; background: #f6f3ee; }
.sh-shell { min-height: 100vh; }
.sh-app *, .sh-app *::before, .sh-app *::after { box-sizing: border-box; }
.sh-app h1, .sh-app h2, .sh-app h3 { margin: 0; line-height: 1.25; color: var(--sh-texto); }
.sh-app h1 { font-size: 1.6rem; }
.sh-app h2 { font-size: 1.25rem; }
.sh-app h3 { font-size: 1.05rem; color: var(--sh-turquesa-osc); margin-bottom: 12px; }
.sh-app p { margin: 0 0 10px; }
.sh-app a { color: var(--sh-turquesa-osc); }
.sh-muted, .sh-meta, .sh-help { color: var(--sh-suave); font-size: .88rem; }
.sh-meta { display: block; }

/* Encabezado */
.sh-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 3px solid var(--sh-naranja); }
.sh-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--sh-texto) !important; }
.sh-brand img { height: 44px; width: auto; display: block; }
.sh-brand span { font-weight: 700; font-size: 1.1rem; }
.sh-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: .92rem; }
.sh-nav a { text-decoration: none; font-weight: 600; padding: 6px 0; }
.sh-user { color: var(--sh-suave); }

/* Avisos */
.sh-notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; border: 1px solid; }
.sh-notice-success { background: #e8f4ee; border-color: #b9dcc9; color: #1f5c43; }
.sh-notice-error { background: #fbeaea; border-color: #eec2c2; color: #8f2224; }
.sh-notice-warning { background: #fff4e0; border-color: #f0d9a8; color: #7a5410; }

/* Botones */
.sh-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--sh-borde);
	background: #fff; color: var(--sh-texto) !important; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.sh-btn:hover { border-color: var(--sh-turquesa); }
.sh-btn-primary { background: var(--sh-naranja); border-color: var(--sh-naranja); color: #fff !important; }
.sh-btn-primary:hover { background: var(--sh-naranja-osc); border-color: var(--sh-naranja-osc); }
.sh-btn-ghost { background: transparent; border-style: dashed; color: var(--sh-turquesa-osc) !important; }
.sh-link-danger { background: none; border: 0; padding: 4px 0; color: var(--sh-error) !important; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: underline; }

.sh-back { margin-bottom: 8px; }
.sh-back a { text-decoration: none; font-weight: 600; }

/* Lista */
.sh-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.sh-search { display: flex; flex: 1 1 260px; gap: 8px; }
.sh-search input { flex: 1; min-width: 0; }
.sh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sh-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--sh-tarjeta); border: 1px solid var(--sh-borde); border-radius: 14px; text-decoration: none; color: var(--sh-texto) !important; }
.sh-item:hover { border-color: var(--sh-turquesa); box-shadow: 0 2px 10px rgba(63, 154, 165, .15); }
.sh-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--sh-turquesa); color: #fff; display: grid; place-items: center; font-weight: 700; }
.sh-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sh-item { flex-wrap: wrap; }
.sh-item-main { flex: 1 1 60%; }
.sh-item-side { flex: 1 1 100%; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding-left: 54px; }
.sh-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #e4f1f3; color: var(--sh-turquesa-osc); }
.sh-badge-prevencion { background: #fde8e1; color: var(--sh-naranja-osc); }
.sh-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.sh-empty { text-align: center; padding: 36px 16px; background: var(--sh-tarjeta); border: 1px dashed var(--sh-borde); border-radius: 14px; }

/* Ficha */
.sh-ficha-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.sh-name { margin-bottom: 14px; }
.sh-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.sh-tab { flex: none; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--sh-borde); background: #fff; color: var(--sh-texto); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sh-tab.is-active { background: var(--sh-turquesa); border-color: var(--sh-turquesa); color: #fff; }
.sh-panel { display: none; }
.sh-panel.is-active { display: block; }
.sh-card { background: var(--sh-tarjeta); border: 1px solid var(--sh-borde); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.sh-card-plan h3 { color: var(--sh-naranja-osc); }

/* Formularios */
.sh-grid { display: grid; grid-template-columns: 1fr; gap: 12px 16px; }
.sh-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sh-f label { font-weight: 600; font-size: .92rem; }
.sh-app input[type="text"], .sh-app input[type="tel"], .sh-app input[type="email"], .sh-app input[type="date"],
.sh-app input[type="search"], .sh-app select, .sh-app textarea, .sh-app input[type="password"] {
	width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--sh-borde); border-radius: 10px;
	background: #fff; color: var(--sh-texto); font: inherit; font-size: 16px; /* 16px evita el zoom en iPhone */
}
.sh-app textarea { resize: vertical; line-height: 1.5; }
.sh-app input:focus, .sh-app select:focus, .sh-app textarea:focus { outline: 2px solid var(--sh-turquesa); outline-offset: 1px; border-color: var(--sh-turquesa); }
.sh-check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; }
.sh-check input { width: 22px; height: 22px; }

/* Plan de acción */
.sh-plan-row { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 12px; margin-bottom: 12px; background: #fcfaf7; border: 1px solid var(--sh-borde); border-radius: 12px; }
.sh-plan-actions { text-align: right; }

/* Adjuntos */
.sh-files { list-style: none; margin: 0 0 14px; padding: 0; }
.sh-files li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--sh-borde); }
.sh-files li a:first-child { font-weight: 600; word-break: break-word; }
.sh-upload { padding-top: 6px; }
.sh-upload > label { font-weight: 700; display: block; margin-bottom: 6px; }
.sh-upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sh-upload-row select { width: auto; flex: 0 1 260px; }

/* Evoluciones */
.sh-timeline { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.sh-timeline a { display: flex; gap: 14px; padding: 12px 14px; border: 1px solid var(--sh-borde); border-radius: 12px; text-decoration: none; color: var(--sh-texto) !important; background: #fcfaf7; }
.sh-timeline a:hover { border-color: var(--sh-turquesa); }
.sh-date { flex: none; font-weight: 700; color: var(--sh-naranja-osc); min-width: 82px; }
.sh-snippet { color: var(--sh-suave); font-size: .92rem; margin-top: 4px; }

/* Informes */
.sh-report-cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
.sh-report { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 16px; border: 1px solid var(--sh-borde); border-radius: 12px; text-decoration: none; color: var(--sh-texto) !important; background: #fcfaf7; }
.sh-report:hover { border-color: var(--sh-naranja); }

/* Barra de guardado flotante */
.sh-savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 10px 14px; margin: 16px 0 0; background: rgba(255, 255, 255, .96); border: 1px solid var(--sh-borde); border-radius: 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, .12); backdrop-filter: blur(4px); }
.sh-savebar-hint { color: var(--sh-naranja-osc); font-weight: 600; font-size: .9rem; }

/* Tabla del registro */
.sh-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--sh-borde); border-radius: 12px; }
.sh-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.sh-table th, .sh-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--sh-borde); vertical-align: top; }
.sh-table th { background: #f4f7f7; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--sh-suave); }

/* Login */
.sh-login { max-width: 400px; margin: 24px auto; padding: 28px 24px; background: #fff; border: 1px solid var(--sh-borde); border-radius: 16px; text-align: center; }
.sh-login-logo { height: 64px; width: auto; margin-bottom: 8px; }
.sh-login form { text-align: left; margin-top: 16px; }
.sh-login p { margin-bottom: 12px; }
.sh-login label { font-weight: 600; display: block; margin-bottom: 4px; }
.sh-login input[type="submit"] { width: 100%; min-height: 46px; border: 0; border-radius: 10px; background: var(--sh-naranja); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.sh-login .login-remember label { display: flex; align-items: center; gap: 8px; font-weight: 400; }

@media (min-width: 720px) {
	.sh-app { padding: 24px; }
	.sh-item { flex-wrap: nowrap; }
	.sh-item-main { flex: 1; }
	.sh-item-side { flex: none; flex-direction: column; align-items: flex-end; text-align: right; padding-left: 0; }
	.sh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sh-full { grid-column: 1 / -1; }
	.sh-plan-row { grid-template-columns: 1fr 1fr 1fr; }
	.sh-plan-row .sh-full { grid-column: 1 / -1; }
	.sh-plan-actions { grid-column: 1 / -1; }
	.sh-report-cards { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
	.sh-app { padding: 24px 32px 40px; }
	.sh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.sh-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sh-plan-row { grid-template-columns: 3fr 1.6fr 1fr 1fr auto; align-items: start; }
	.sh-plan-row .sh-full { grid-column: auto; }
	.sh-plan-actions { grid-column: auto; align-self: end; padding-bottom: 8px; }
	.sh-report-cards { grid-template-columns: repeat(3, 1fr); }
	.sh-name { max-width: 520px; }
}
@media (min-width: 1500px) {
	.sh-app { max-width: 1480px; }
}
