/* dashboard.css - estilo del dashboard WSSP (variables del frontend CTPS) */

[data-theme="ctps"][data-mode="light"],
[data-mode="light"] {
	--bg: #f8fafc;
	--surface: #ffffff;
	--surface-2: #f1f5f9;
	--surface-3: #e2e8f0;
	--border: #e2e8f0;
	--border-strong: #cbd5e1;
	--hover: #f1f5f9;
	--accent: #00a651;
	--accent-hover: #008944;
	--accent-2: #3b82f6;
	--accent-glow: rgba(0, 166, 81, 0.14);
	--accent-bg: rgba(0, 166, 81, 0.1);
	--text: #1e293b;
	--text-2: #64748b;
	--text-3: #94a3b8;
	--text-inverse: #ffffff;
	--success: #16a34a;
	--warning: #fd7e14;
	--error: #dc2626;
	--info: #2563eb;
	--font-display:
		"Poppins", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
		sans-serif;
	--font-body:
		"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--radius: 6px;
	--radius-lg: 8px;
	--radius-full: 9999px;
	--shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
	--shadow-panel: 0 12px 32px rgba(15, 23, 42, 0.12);
	--sidebar-width: 250px;
	--sidebar-collapsed-width: 60px;
	--modal-overlay: rgba(15, 23, 42, 0.55);
}

[data-theme="ctps"][data-mode="dark"],
[data-mode="dark"] {
	--bg: #1a1a1a;
	--surface: #2d2d2d;
	--surface-2: #262626;
	--surface-3: #404040;
	--border: #404040;
	--border-strong: #525252;
	--hover: #404040;
	--accent: #26bf6b;
	--accent-hover: #4dd485;
	--accent-2: #3b82f6;
	--accent-glow: rgba(38, 191, 107, 0.18);
	--accent-bg: rgba(38, 191, 107, 0.14);
	--text: #e2e8f0;
	--text-2: #94a3b8;
	--text-3: #64748b;
	--text-inverse: #0f172a;
	--success: #4ade80;
	--warning: #fb923c;
	--error: #f87171;
	--info: #60a5fa;
	--font-display:
		"Poppins", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
		sans-serif;
	--font-body:
		"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--radius: 6px;
	--radius-lg: 8px;
	--radius-full: 9999px;
	--shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
	--shadow-panel: 0 16px 36px rgba(0, 0, 0, 0.35);
	--sidebar-width: 250px;
	--sidebar-collapsed-width: 60px;
	--modal-overlay: rgba(0, 0, 0, 0.78);
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 0.875rem;
	line-height: 1.5;
}

a {
	color: inherit;
	text-decoration: none;
}

/* ---------- Layout ---------- */
.layout {
	display: grid;
	grid-template-columns: var(--sidebar-width) 1fr;
	min-height: 100vh;
}

.sidebar {
	background: var(--surface-2);
	border-right: 1px solid var(--border);
	padding: 16px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
}

.sidebar__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1rem;
	padding: 8px 12px;
	margin-bottom: 8px;
	color: var(--accent);
}

.sidebar__nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sidebar__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: var(--radius);
	color: var(--text-2);
	font-weight: 600;
	transition:
		background 0.15s ease,
		color 0.15s ease;
}

.sidebar__link:hover {
	background: var(--hover);
	color: var(--text);
}
.sidebar__link--active {
	background: var(--accent-bg);
	color: var(--accent);
}

.main {
	padding: 24px;
	min-width: 0;
}

.page-title {
	margin: 0 0 20px;
	font-family: var(--font-display);
	font-size: 1.6rem;
	font-weight: 700;
}

.grid {
	display: grid;
	gap: 16px;
}
.grid--2 {
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ---------- Componentes (ui-kit) ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: transparent;
	color: var(--text);
	font-family: var(--font-body);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		color 0.15s ease;
	white-space: nowrap;
}
.btn:hover:not(:disabled) {
	transform: translateY(-1px);
}
.btn:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}
.btn--primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--text-inverse);
}
.btn--primary:hover:not(:disabled) {
	background: var(--accent-hover);
}
.btn--ghost {
	border-color: var(--border);
	background: var(--surface);
}
.btn--ghost:hover:not(:disabled) {
	background: var(--hover);
	border-color: var(--border-strong);
}
.btn--danger {
	background: var(--error);
	border-color: var(--error);
	color: #fff;
}
.btn--danger:hover:not(:disabled) {
	filter: brightness(0.93);
}
.btn--sm {
	min-height: 34px;
	padding: 6px 12px;
	font-size: 0.8rem;
}

.input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 0.875rem;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease;
}
.input::placeholder {
	color: var(--text-3);
}
.input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.card {
	padding: 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-card);
}

.card__title {
	margin: 0 0 12px;
	font-size: 1rem;
	font-weight: 700;
}

.badge {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	min-height: 24px;
	padding: 3px 10px;
	border: 1px solid transparent;
	border-radius: var(--radius-full);
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.badge--success {
	background: var(--accent-glow);
	color: var(--accent);
}
.badge--muted {
	background: var(--surface-3);
	color: var(--text-2);
}
.badge--danger {
	background: color-mix(in srgb, var(--error) 18%, transparent);
	color: var(--error);
}
.badge--warning {
	background: color-mix(in srgb, var(--warning) 18%, transparent);
	color: var(--warning);
}

.table-wrapper {
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	overflow-x: auto;
}
.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}
.table thead {
	background: var(--surface-2);
}
.table th {
	padding: 12px 16px;
	text-align: left;
	font-weight: 700;
	color: var(--text);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}
.table td {
	padding: 12px 16px;
	color: var(--text);
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}
.table tbody tr:hover {
	background: var(--hover);
}
.td-mono {
	font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
	font-size: 0.82rem;
	color: var(--text-2);
}
.td-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.form-card {
	display: grid;
	gap: 16px;
	padding: 24px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
}
.form-field {
	display: grid;
	gap: 6px;
}
.form-label {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-2);
}
.form-error {
	font-size: 0.78rem;
	color: var(--error);
}
.form-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--border);
}

/* Estados */
.muted {
	color: var(--text-2);
}
.mono {
	font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
}
.empty {
	padding: 32px 16px;
	text-align: center;
	color: var(--text-2);
	font-style: italic;
}

.code-block {
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px 16px;
	overflow-x: auto;
	font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
	font-size: 0.8rem;
	color: var(--text);
	line-height: 1.5;
	white-space: pre;
}

.docs-section + .docs-section {
	margin-top: 20px;
}
.docs-section h4 {
	margin: 0 0 8px;
}

/* Skeleton */
.skeleton {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--surface-3);
}
.skeleton::after {
	position: absolute;
	inset: 0;
	content: "";
	background: linear-gradient(
		90deg,
		transparent 0%,
		var(--surface) 48%,
		transparent 100%
	);
	opacity: 0.72;
	transform: translateX(-100%);
	animation: shimmer 1.35s ease-in-out infinite;
}
@keyframes shimmer {
	100% {
		transform: translateX(100%);
	}
}

/* Login */
.auth-screen {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 24px;
	background: var(--bg);
}
.auth-box {
	width: 100%;
	max-width: 400px;
	padding: 32px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-panel);
}
.auth-logo {
	width: 64px;
	height: 64px;
	margin: 0 auto 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-full);
	background: var(--accent);
	color: var(--text-inverse);
	font-family: var(--font-display);
	font-size: 1.8rem;
	font-weight: 700;
}
.auth-title {
	margin: 0 0 4px;
	text-align: center;
	font-family: var(--font-display);
	font-size: 1.5rem;
}
.auth-sub {
	margin: 0 0 20px;
	text-align: center;
	color: var(--text-2);
}
.auth-desc {
	margin: 0 0 16px;
	line-height: 1.5;
}
.auth-legal {
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
	font-size: 0.78rem;
	color: var(--text-2);
	text-align: center;
}
.auth-legal a {
	color: var(--accent-2);
}
.auth-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	font-size: 0.75rem;
	color: var(--text-3);
}
.auth-footer a {
	color: var(--text-2);
}
.auth-footer a:hover {
	color: var(--accent);
}

.btn--block {
	width: 100%;
}

.otp-grid {
	display: flex;
	gap: 8px;
	justify-content: center;
}
.otp-input {
	width: 48px;
	height: 56px;
	text-align: center;
	font-size: 1.4rem;
	font-weight: 700;
}

.notice {
	padding: 12px 16px;
	border-radius: var(--radius);
	margin-bottom: 16px;
	font-size: 0.85rem;
}
.notice--success {
	background: var(--accent-glow);
	color: var(--accent);
}
.notice--error {
	background: color-mix(in srgb, var(--error) 14%, transparent);
	color: var(--error);
}

/* Modal */
.modal-backdrop {
	position: fixed;
	inset: 0;
	background: var(--modal-overlay);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	padding: 16px;
}
.modal {
	width: 100%;
	max-width: 560px;
	padding: 24px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
}
.modal h3 {
	margin: 0 0 16px;
}
.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
	.layout {
		grid-template-columns: 1fr;
	}
	.sidebar {
		position: fixed;
		inset: 0 auto 0 0;
		width: var(--sidebar-width);
		transform: translateX(-100%);
		transition: transform 0.2s ease;
		box-shadow: var(--shadow-panel);
		z-index: 90;
	}
	.sidebar--open {
		transform: translateX(0);
	}
	.main {
		padding: 16px;
	}
}
