/* ============================================================
   modern.css - Capa de estilos modernos (misma estructura de UI)
   Se carga después de layout.css; usa "body" para ganar especificidad.
   ============================================================ */
:root {
	--brand: #860038;
	--brand-dark: #5b0026;
	--brand-soft: #fbeef3;
	--text: #1f2937;
	--muted: #6b7280;
	--border: #e5e7eb;
	--bg: #f4f5f7;
	--card: #ffffff;
	--radius: 10px;
	--shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--text);
	background: var(--bg);
}

body a { color: var(--brand); text-decoration: none; }
body a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ---------- Header / navegación ---------- */
body .wrapper.col1 {
	background: var(--brand);
	background-image: none;
	box-shadow: var(--shadow);
}
body #header {
	width: 100%;
	max-width: 1200px;
	padding: 0 16px;
	min-height: 56px;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}
body #topnav {
	float: none;
	margin: 0;
	width: auto;
	height: auto;
	font-family: inherit;
	font-size: 13px;
}
body #topnav > ul { display: flex; flex-direction: row-reverse; gap: 4px; align-items: center; }
body #topnav li { float: none; margin: 0; position: relative; }
body #topnav li a:link,
body #topnav li a:visited {
	display: block;
	padding: 18px 14px;
	color: #fff;
	text-transform: none;
	font-weight: 600;
	letter-spacing: .2px;
}
body #topnav li a:hover,
body #topnav li.active a {
	color: #fff;
	background: rgba(255, 255, 255, .15);
	text-decoration: none;
}
body #topnav ul ul {
	position: absolute;
	left: -999em;
	top: 100%;
	width: 220px;
	border: 1px solid var(--border);
	border-radius: 0 0 var(--radius) var(--radius);
	background: var(--card);
	box-shadow: var(--shadow);
	overflow: hidden;
}
body #topnav li:hover > ul { left: 0; }
body #topnav li li a:link,
body #topnav li li a:visited {
	width: auto;
	padding: 10px 14px;
	color: var(--text);
	background: var(--card);
	font-weight: 500;
}
body #topnav li li a:hover { background: var(--brand-soft); color: var(--brand); }

/* ---------- Contenido ---------- */
body #page,
body .shell { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
body .wrapper.col2 { background: transparent; padding: 24px 0; }

body fieldset {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 16px 20px;
	margin: 0 0 16px;
}
body legend { font-size: 15px; color: var(--brand); padding: 0 8px; }

/* ---------- Formularios ---------- */
body input[type="text"],
body input[type="password"],
body input[type="email"],
body input[type="number"],
body input:not([type]),
body select,
body textarea {
	font: inherit;
	color: var(--text);
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px 10px;
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}
body input:focus, body select:focus, body textarea:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(134, 0, 56, .15);
}
body input[type="submit"],
body input[type="button"],
body button,
body .btn {
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--brand);
	border: 0;
	border-radius: 8px;
	padding: 9px 18px;
	cursor: pointer;
	transition: background .15s, transform .05s;
}
body input[type="submit"]:hover,
body input[type="button"]:hover,
body button:hover,
body .btn:hover { background: var(--brand-dark); }
body input[type="submit"]:active,
body button:active { transform: translateY(1px); }
body input[disabled], body button[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Tablas ---------- */
body table { border-collapse: collapse; }
body table.display,
body table.dataTable {
	width: 100%;
	background: var(--card);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
}
body table.display thead th,
body table.dataTable thead th {
	background: var(--brand);
	color: #fff;
	font-weight: 600;
	padding: 12px 10px;
	border: 0;
	text-align: left;
}
body table.display tbody td,
body table.dataTable tbody td { padding: 10px; border-top: 1px solid var(--border); }
body table.display tbody tr:hover td { background: var(--brand-soft); }
body tr.odd td, body tr.even td { background: transparent; }
body tr.gradeU:hover td { background: var(--brand-soft); }
body .dataTables_wrapper { font-size: 13px; color: var(--muted); }
body .dataTables_filter input { margin-left: 6px; }
body .dataTables_paginate .paginate_button,
body .dataTables_paginate .paginate_active {
	border-radius: 6px;
	padding: 4px 10px;
	border: 1px solid var(--border);
	background: #fff;
	margin: 0 2px;
}
body .dataTables_paginate .paginate_active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- jQuery UI (diálogos, tooltips) ---------- */
body .ui-dialog { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 0; overflow: hidden; }
body .ui-dialog .ui-dialog-titlebar { background: var(--brand); color: #fff; border: 0; border-radius: 0; }
body .ui-widget-content { border-color: var(--border); }
body .ui-tooltip { border-radius: 8px; border: 1px solid var(--border); box-shadow: var(--shadow); padding: 6px 10px; }

/* ---------- Login ---------- */
body.login-modern {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}
.login-card {
	width: 100%;
	max-width: 380px;
	margin: 16px;
	padding: 32px 28px;
	background: var(--card);
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
	text-align: center;
}
.login-card img { max-width: 180px; margin-bottom: 12px; }
.login-card h1, .login-card h2 { margin: 0 0 4px; color: var(--brand); font-size: 20px; }
.login-card .field { text-align: left; margin-top: 14px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.login-card input[type="text"],
.login-card input[type="password"] { width: 100%; padding: 11px 12px; }
.login-card button { width: 100%; margin-top: 20px; padding: 12px; text-transform: uppercase; letter-spacing: .5px; }
.login-card .alert-error {
	margin-top: 14px; padding: 10px 12px; border-radius: 8px; font-size: 13px;
	color: #991b1b; background: #fee2e2; border: 1px solid #fecaca;
}
.login-card .copyright { margin-top: 20px; font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
	body #header { justify-content: center; }
	body #topnav li a:link, body #topnav li a:visited { padding: 14px 10px; }
	body fieldset { padding: 12px; }
}

/* ---------- Formularios de detalles.php (control-group / controls) ---------- */
body .control-group {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 6px;
clear: both;
}
body .control-group .control-label {
flex: 0 0 85px;
margin: 0;
text-align: left;
font-weight: 600;
font-size: 13px;
color: var(--muted);
}
body .control-group .controls { flex: 0 1 auto; min-width: 0; text-align: left; }
/* ancho por defecto; los style="width:..." inline siguen mandando */
body .controls input[type="text"],
body .controls input:not([type]) { width: 200px; max-width: 100%; height: 28px; padding: 3px 8px; font-size: 13px; }

/* Layout de detalles.php: cuadrícula de 2 columnas (datos | cédulas/botones).
   #ladoderecho se "disuelve" (display:contents) para que sus filas y el bloque
   Plan participen en la misma cuadrícula que #ladoizquierdo. */
body #contact-form2 > div {
	display: grid;
	grid-template-columns: max-content 300px;
	justify-content: center;
	column-gap: 16px;
	align-items: start;
	width: 100% !important;
	max-width: 760px;
	margin: 0 auto;
}
body #ladoderecho { display: contents; }
body #ladoizquierdo {
	grid-column: 2;
	grid-row: 1 / span 4;
	width: auto !important;
	height: auto !important;
	float: none !important;
}
/* la primera fila de #ladoizquierdo solo tenía <br> como separador */
body #ladoizquierdo > .control-group:first-child { display: none; }
/* Bloques de ancho completo (Plan, urgencias, pre-existencia, etc.) */
body #contact-form2 > div > div:not(#ladoderecho):not(#ladoizquierdo),
body #ladoderecho > .control-group[style*="950px"] {
	grid-column: 1 / -1;
	width: 100% !important;
	height: auto !important;
	float: none !important;
	margin-left: 0 !important;
}
/* Fila "Plan": etiqueta + input, y debajo la red y la tabla de deducibles */
body #ladoderecho > .control-group[style*="950px"] { flex-wrap: wrap; align-items: flex-start; }
body #ladoderecho > .control-group[style*="950px"] > .controls:first-of-type { flex: 1 1 0; }
body #ladoderecho > .control-group[style*="950px"] > .controls:not(:first-of-type),
body #ladoderecho > .control-group[style*="950px"] > legend,
body #ladoderecho > .control-group[style*="950px"] > br { flex: 0 0 100%; width: 100%; }
body #ladoderecho > .control-group[style*="950px"] > legend { display: block; }
body #ladoderecho .controls input[style*="512px"] { width: 100% !important; max-width: 480px; }
body #continuidad_deducible table { width: 100%; background: var(--card); font-size: 12px; }
body #continuidad_deducible td,
body #continuidad_deducible th { padding: 3px 6px; }

/* Buscador de documento */
body .filtro ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; justify-content: center; align-items: center; gap: 8px; }
body .filtro input[type="text"] { width: 160px; height: 28px; padding: 3px 8px; }
body .filtro input[type="image"] { background: transparent; padding: 0; border-radius: 0; }

/* Radios y selects de urgencias */
body input[type="radio"] { margin: 0 3px 0 8px; vertical-align: middle; }
body #select1, body #combobox { height: 28px; min-width: 180px; padding: 2px 6px; font-size: 13px; }

@media (max-width: 900px) {
body #contact-form2 > div { grid-template-columns: 1fr; }
body #ladoizquierdo { grid-column: 1; grid-row: auto; }
body .control-group { flex-wrap: wrap; }
}
