/* RIE-SALUD v2 - Tema visual compartido con el sistema principal */

:root {
	color-scheme: light;
	--rie-mint: #85cfbc;
	--rie-orange: #ec811a;
	--rie-sky: #65aadd;

	--bg: #f7faf9;
	--card: #ffffff;
	--border: #dce7e4;

	--text: #1b1d1c;
	--muted: #55605e;
	--disabled: #8a9794;

	--success: #22c55e;
	--warning: #f59e0b;
	--danger: #ef4444;

	--radius-sm: 12px;
	--radius-md: 16px;
	--radius-lg: 20px;
}

html, body {
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	color: var(--text);
	background: var(--bg);
}

a {
	color: var(--rie-sky);
	text-decoration: none;
}

a:hover {
	color: #2563eb;
}

h1, h2, h3, h4, h5, h6 {
	font-family: 'Manrope', system-ui, sans-serif;
}

/* ---------- Shell / Topbar / Nav ---------- */

.rie-shell {
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
}

.rie-content {
	max-width: 80rem;
	margin: 0 auto;
	padding: 1.25rem 1.5rem 2.5rem;
}

.rie-topbar {
	background: linear-gradient(90deg, rgba(133, 207, 188, 0.9), rgba(101, 170, 221, 0.9) 55%, rgba(133, 207, 188, 0.9));
	color: var(--text);
}

.rie-topbar-inner {
	max-width: 80rem;
	margin: 0 auto;
	padding: 0.75rem 1.5rem;
	display: flex;
	align-items: center;
	gap: 1rem;
}

.rie-logo-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.3rem 0.75rem;
	border-radius: 9999px;
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid rgba(255, 255, 255, 0.6);
	box-shadow: 0 6px 16px rgba(27, 29, 28, 0.12);
}

.rie-logo {
	height: 2rem;
	width: auto;
}

.rie-topbar-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
}

.rie-user-btn {
	background: rgba(255, 255, 255, 0.85);
	color: var(--text);
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 9999px;
	padding: 0.45rem 0.95rem;
	min-height: 2.25rem;
	font-weight: 700;
	font-size: 0.85rem;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.rie-logout-btn {
	background: transparent;
	border: none;
	color: var(--text);
	font-weight: 700;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	cursor: pointer;
}

.rie-logout-btn:hover {
	color: var(--rie-orange);
}

.rie-icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 9999px;
	border: 1px solid rgba(255, 255, 255, 0.6);
	background: rgba(255, 255, 255, 0.85);
	color: var(--text);
	transition: all 0.2s ease;
}

.rie-icon-btn:hover {
	background: rgba(255, 255, 255, 0.95);
}

.rie-badge-dot {
	position: absolute;
	top: -0.25rem;
	right: -0.25rem;
	min-width: 1.1rem;
	height: 1.1rem;
	padding: 0 0.3rem;
	border-radius: 9999px;
	background: var(--rie-sky);
	color: #ffffff;
	font-size: 0.65rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 10px rgba(27, 29, 28, 0.18);
}

.rie-badge-dot-orange {
	background: var(--rie-orange);
}

.rie-dropdown {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: 0 20px 40px rgba(27, 29, 28, 0.12);
	padding: 0.4rem;
	min-width: 16rem;
}

.rie-dropdown-title {
	padding: 0.5rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
}

.rie-dropdown-item {
	padding: 0.5rem 0.75rem;
	border-radius: var(--radius-sm);
}

.rie-dropdown-item-title {
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--text);
}

.rie-dropdown-item-text {
	font-size: 0.8rem;
	color: var(--muted);
}

.rie-dropdown-empty {
	padding: 0.75rem;
	font-size: 0.85rem;
	color: var(--muted);
	text-align: center;
}

.rie-dropdown-link {
	display: block;
	padding: 0.5rem 0.75rem;
	border-radius: var(--radius-sm);
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--rie-sky);
	text-align: center;
}

.rie-dropdown-link:hover {
	background: #eaf7f4;
	color: var(--rie-sky);
}

.rie-page-header {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: 0 14px 30px rgba(27, 29, 28, 0.08);
	padding: 1.1rem 1.5rem;
	margin-bottom: 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.rie-page-header-title {
	font-size: 1.4rem;
	font-weight: 800;
	color: var(--text);
	margin: 0;
}

.rie-page-header-subtitle {
	font-size: 0.85rem;
	color: var(--muted);
	margin: 0.15rem 0 0;
}

.rie-quick-action {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.75rem 0.9rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	color: var(--text);
	font-size: 0.88rem;
	font-weight: 600;
	transition: all 0.15s ease;
}

.rie-quick-action:hover {
	background: #eaf7f4;
	color: var(--text);
	border-color: var(--rie-mint);
}

.rie-stat-icon {
	color: var(--muted);
}

.rie-activity-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--border);
}

.rie-activity-item:last-child {
	border-bottom: none;
}

.rie-activity-icon {
	width: 2rem;
	height: 2rem;
	border-radius: 9999px;
	background: #f1f6f4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: var(--muted);
}

.rie-alert-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--border);
}

.rie-alert-row:last-child {
	border-bottom: none;
}

.rie-alert-dot {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 9999px;
	flex-shrink: 0;
	display: inline-block;
}

.rie-nav-row {
	background: var(--card);
	border-bottom: 1px solid var(--border);
}

.rie-nav-container {
	max-width: 80rem;
	margin: 0 auto;
	padding: 0.75rem 1.5rem;
}

.rie-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 1.75rem;
}

.rie-nav-link {
	display: inline-flex;
	align-items: center;
	padding: 0.15rem 0 0.6rem;
	border-bottom: 2px solid transparent;
	color: var(--muted);
	font-size: 0.92rem;
	font-weight: 600;
	line-height: 1.25;
	flex: 0 0 auto;
	transition: all 0.15s ease;
}

.rie-nav-link:hover {
	color: var(--text);
	border-bottom-color: #d1d5db;
}

.rie-nav-link-active,
.rie-nav-link-active:hover {
	color: var(--text);
	border-bottom-color: var(--rie-mint);
}

/* ---------- Cards ---------- */

.card,
.rie-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: 0 12px 24px rgba(27, 29, 28, 0.06);
	padding: 1.5rem;
}

.card-header {
	background: transparent;
	border-bottom: 1px solid var(--border);
	font-weight: 700;
	margin: 0 0 1rem;
	padding: 0 0 1rem;
}

.table-wrap {
	overflow-x: auto;
}

.rie-stat-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.rie-stat-label {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
}

.rie-stat-value {
	font-size: 2rem;
	font-weight: 800;
	color: var(--text);
	font-family: 'Manrope', system-ui, sans-serif;
}

/* ---------- Tables ---------- */

.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	color: var(--text);
}

.table th {
	text-align: left;
	padding: 0.85rem 1rem;
	font-weight: 700;
	color: var(--muted);
	background: #f1f6f4;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

.table td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}

.table tbody tr:last-child td {
	border-bottom: none;
}

.table tbody tr:hover {
	background: #f9fbfb;
}

/* ---------- Buttons ---------- */

.btn {
	border-radius: 9999px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: 0.8rem;
	padding: 0.6rem 1.3rem;
	transition: all 0.2s ease;
	border: none;
}

.btn-sm {
	padding: 0.4rem 0.9rem;
	font-size: 0.7rem;
}

.btn-primary {
	background: var(--rie-orange);
	color: #ffffff;
	border-color: var(--rie-orange);
}

.btn-primary:hover,
.btn-primary:focus {
	background: #d87314;
	border-color: #d87314;
	color: #ffffff;
	transform: translateY(-1px);
}

.btn-secondary,
.btn-outline-secondary {
	border: 1px solid var(--rie-mint);
	color: var(--text);
	background: var(--card);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
	background: #eaf7f4;
	color: var(--text);
}

.btn-danger,
.btn-outline-danger {
	background: var(--danger);
	color: #ffffff;
	border-color: var(--danger);
}

.btn-danger:hover,
.btn-outline-danger:hover {
	background: #dc2626;
	border-color: #dc2626;
	color: #ffffff;
}

.btn-outline-danger {
	background: #ffecec;
	color: var(--danger);
	border-color: var(--danger);
}

/* ---------- Badges ---------- */

.badge {
	border-radius: 9999px;
	padding: 0.3rem 0.7rem;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.text-bg-success { background: #eafbef !important; color: var(--success) !important; }
.text-bg-secondary { background: #eef2f1 !important; color: var(--muted) !important; }
.text-bg-warning { background: #fff7e6 !important; color: var(--warning) !important; }
.text-bg-danger { background: #ffecec !important; color: var(--danger) !important; }
.text-bg-info { background: #eaf4ff !important; color: #2563eb !important; }
.text-bg-primary { background: #fff3e8 !important; color: var(--rie-orange) !important; }

/* ---------- Forms ---------- */

.form-control,
.form-select {
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	padding: 0.6rem 0.9rem;
	background: var(--card);
	color: var(--text);
	transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
	border-color: var(--rie-sky);
	box-shadow: 0 0 0 3px rgba(101, 170, 221, 0.35);
	outline: none;
}

.form-label {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--muted);
	font-weight: 700;
	margin-bottom: 0.35rem;
}

.form-check-input:checked {
	background-color: var(--rie-orange);
	border-color: var(--rie-orange);
}

.form-check-input:focus {
	border-color: var(--rie-sky);
	box-shadow: 0 0 0 3px rgba(101, 170, 221, 0.25);
}

/* ---------- Alerts ---------- */

.alert {
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	padding: 0.85rem 1.25rem;
	font-size: 0.9rem;
	font-weight: 500;
}

.alert-success {
	background: #ecfdf5;
	color: #047857;
	border-color: #a7f3d0;
}

.alert-danger {
	background: #fef2f2;
	color: #b91c1c;
	border-color: #fecaca;
}

/* ---------- Pagination ---------- */

.pagination {
	display: flex;
	gap: 0.35rem;
	flex-wrap: wrap;
}

.page-link {
	border-radius: 9999px !important;
	border: 1px solid var(--border);
	color: var(--text);
	padding: 0.4rem 0.85rem;
	font-weight: 700;
	font-size: 0.85rem;
}

.page-link:hover {
	background: #eaf7f4;
	color: var(--text);
}

.page-item.active .page-link {
	background: var(--rie-orange);
	border-color: var(--rie-orange);
	color: #ffffff;
}

.page-item.disabled .page-link {
	color: var(--disabled);
	background: transparent;
}

/* ---------- Filters ---------- */

.rie-filter-card {
	margin-bottom: 1.5rem;
}

.rie-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	border-radius: 9999px;
	padding: 0.3rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 700;
	background: #eaf7f4;
	color: var(--text);
}

.rie-filter-chip-clear {
	background: #eef2f1;
	color: var(--muted);
	border: none;
	cursor: pointer;
}

.rie-checkbox-list {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	max-height: 130px;
	overflow-y: auto;
}

.rie-checkbox-list label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0.75rem;
	font-size: 0.85rem;
	border-bottom: 1px solid var(--border);
	cursor: pointer;
}

.rie-checkbox-list label:last-child {
	border-bottom: none;
}

.rie-checkbox-list label:hover {
	background: #f9fbfb;
}

/* ---------- Auth page ---------- */

.rie-auth-shell {
	max-width: 80rem;
	margin: 0 auto;
	padding: 2.5rem 1.5rem;
	min-height: 100vh;
	display: flex;
	align-items: center;
}

.rie-auth-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2rem;
	width: 100%;
}

@media (min-width: 1024px) {
	.rie-auth-grid {
		grid-template-columns: 1.1fr 0.9fr;
		align-items: stretch;
	}
}

.rie-auth-hero {
	position: relative;
	overflow: hidden;
	background: linear-gradient(135deg, rgba(133, 207, 188, 0.95) 0%, rgba(101, 170, 221, 0.9) 55%, rgba(133, 207, 188, 0.95) 100%);
	color: var(--text);
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	box-shadow: 0 25px 60px rgba(27, 29, 28, 0.18);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 1.5rem;
}

.rie-hero-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: rgba(255, 255, 255, 0.35);
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 9999px;
	padding: 0.35rem 0.9rem;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	width: fit-content;
}

.rie-auth-card {
	background: var(--card);
	border-radius: var(--radius-md);
	padding: 2.5rem;
	box-shadow: 0 20px 50px rgba(27, 29, 28, 0.1);
	border: 1px solid var(--border);
	position: relative;
}

.rie-auth-card::before {
	content: '';
	position: absolute;
	top: -2px;
	left: -2px;
	right: -2px;
	height: 10px;
	border-radius: var(--radius-md) var(--radius-md) var(--radius-sm) var(--radius-sm);
	background: linear-gradient(90deg, var(--rie-mint), var(--rie-sky), var(--rie-orange));
}

.rie-auth-card-head {
	display: flex;
	align-items: center;
	gap: 1rem;
	background: var(--rie-orange);
	color: #ffffff;
	border-radius: var(--radius-sm);
	padding: 1.25rem;
	margin-bottom: 1.75rem;
}

.rie-auth-logo {
	height: 56px;
	width: 56px;
}

.rie-auth-card-title {
	font-size: 1.6rem;
	font-weight: 800;
	font-family: 'Manrope', system-ui, sans-serif;
}

.rie-auth-card-subtitle {
	font-size: 0.95rem;
	color: rgba(255, 255, 255, 0.92);
}

.rie-heading {
	font-family: 'Manrope', system-ui, sans-serif;
}

.rie-feature-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}

.rie-feature-card {
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.35);
	padding: 1rem;
}

.rie-feature-label {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.2em;
	color: var(--muted);
	margin: 0;
}

.rie-feature-text {
	font-size: 0.9rem;
	color: rgba(27, 29, 28, 0.8);
	margin: 0.5rem 0 0;
}

.rie-hero-logo-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.rie-auth-card .btn-primary {
	background: var(--rie-mint);
	border-color: var(--rie-mint);
}

.rie-auth-card .btn-primary:hover,
.rie-auth-card .btn-primary:focus {
	background: #6fbba6;
	border-color: #6fbba6;
	color: #ffffff;
}

/* ---------- Utilities used alongside Bootstrap grid ---------- */

.text-muted { color: var(--muted) !important; }
