/* Dashboard (index.php). Todo va bajo .dash para no tocar las páginas de login. */

:root {
	/* Colores corporativos: #ABC300 (acento) y #333234 (texto) */
	--bg: #f1f1ee;
	--surface: #ffffff;
	--ink: #333234;
	--muted: #6b6a6d;
	--line: #e1e1dc;
	--track: #e6e6e1;
	--accent: #abc300;
	/* versión oscura del acento para texto: #abc300 no tiene contraste suficiente sobre blanco */
	--accent-ink: #5e6b00;
	--accent-soft: #d9e480;
	--accent-tint: #f3f7d6;
	--ok: #5e6b00;
	--ok-soft: #e8efb8;
	--min: #a86400;
	--gutter: 16px;
	--pad: 20px;
}

html {
	/* evita que Safari iOS agrande el texto por su cuenta */
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body:has(.dash) {
	background: var(--bg);
	color: var(--ink);
	font-family: "Figtree", system-ui, sans-serif;
	overflow-x: clip;
}

body:has(.dash) > header {
	max-width: 1120px;
	margin: 0 auto;
	padding: 16px var(--gutter);
	border: 0 !important;
	flex-wrap: nowrap !important;
	justify-content: space-between !important;
	gap: 12px;
}

body:has(.dash) > header .btn {
	--bs-btn-color: var(--ink);
	--bs-btn-border-color: var(--ink);
	--bs-btn-hover-color: #fff;
	--bs-btn-hover-bg: var(--ink);
	--bs-btn-hover-border-color: var(--ink);
	--bs-btn-active-bg: var(--ink);
	--bs-btn-active-border-color: var(--ink);
	--bs-btn-focus-shadow-rgb: 171, 195, 0;
}

body:has(.dash) > header > * {
	width: auto;
	margin: 0 !important;
}

.dash {
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 var(--gutter) 48px;
	font-variant-numeric: tabular-nums;
}

.dash h2,
.dash h3,
.dash .figure {
	font-family: "Bricolage Grotesque", "Figtree", sans-serif;
	letter-spacing: -0.01em;
}

.dash h2 {
	font-size: 1.125rem;
	font-weight: 700;
	margin: 40px 0 12px;
}

.dash .panel {
	background: var(--surface);
	border-radius: 14px;
	padding: var(--pad);
	min-width: 0;
}

/* Tablas (objetivos y clientes) */

.dash table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.dash th,
.dash td {
	padding: 7px 0 7px 12px;
	border-top: 1px solid var(--line);
	text-align: right;
	white-space: nowrap;
}

.dash th:first-child,
.dash td:first-child {
	padding-left: 0;
	text-align: left;
}

.dash thead th {
	border-top: 0;
	font-weight: 400;
	font-size: 0.8125rem;
	color: var(--muted);
}

.dash tbody th {
	font-weight: 400;
	color: var(--muted);
}

/* Hero: progreso del mes */

.hero-top {
	display: flex;
	flex-wrap: wrap;
	gap: 16px 40px;
	align-items: flex-end;
	justify-content: space-between;
}

.hero-period {
	margin: 0 0 4px;
	color: var(--muted);
}

.hero-amount {
	font-size: clamp(2rem, 7vw, 3rem);
	font-weight: 700;
	line-height: 1;
	margin: 0;
}

.hero-sub {
	margin: 8px 0 0;
	color: var(--muted);
}

.hero-sub strong {
	color: var(--min);
	font-weight: 600;
}

.today {
	display: flex;
	gap: 24px;
	margin: 0;
}

.today dt {
	font-weight: 400;
	color: var(--muted);
	font-size: 0.875rem;
}

.today dd {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 700;
}

.progress-wrap {
	margin-top: 28px;
	/* deja sitio a las etiquetas de los objetivos */
	padding-bottom: 36px;
	position: relative;
}

.track {
	position: relative;
	height: 14px;
	border-radius: 7px;
	background: var(--track);
	/* recorta los rellenos y las marcas a la forma redondeada de la barra */
	overflow: hidden;
}

.fill {
	position: absolute;
	inset: 0 auto 0 0;
	border-radius: 0 7px 7px 0;
	background: repeating-linear-gradient(-45deg, var(--accent-soft) 0 5px, var(--accent-tint) 5px 10px);
}

/* tramo hasta el último hito alcanzado; lo que sigue hasta el total queda rayado */
.fill-hito {
	position: absolute;
	inset: 0 auto 0 0;
	background: var(--accent);
}

/* las marcas son muescas del color del panel, así se leen igual sobre el relleno y sobre el fondo */
.tick {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 2px;
	margin-left: -1px;
	background: var(--surface);
}

.tick-label {
	position: absolute;
	top: 26px;
	transform: translateX(-50%);
	font-size: 0.8125rem;
	white-space: nowrap;
	color: var(--muted);
}

.tick-label .short {
	display: none;
}

.tick-label.min {
	color: var(--min);
}

.tick-label.reached {
	color: var(--ok);
	font-weight: 600;
}

/* el último objetivo se alinea a la derecha para no salirse */
.tick-label.end {
	transform: translateX(-100%);
}

/* Objetivos */

.goals {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.goal h3 {
	font-size: 1rem;
	font-weight: 500;
	color: var(--muted);
	margin: 0 0 6px;
}

.goal .figure {
	font-size: 2rem;
	font-weight: 700;
	line-height: 1.1;
	margin: 0;
}

.goal .per-day {
	margin: 4px 0 16px;
	color: var(--muted);
}

.goal.done {
	background: var(--ok-soft);
}

.goal.done .figure {
	color: var(--ok);
}

.goal tbody td:first-child {
	color: var(--muted);
}

.goal .figure .unit {
	font-size: 0.55em;
	font-weight: 500;
	color: var(--muted);
}

.goal tbody td:last-child {
	color: var(--muted);
}

/* en objetivos, Horas/día solo se destaca por color, sin agrandar */
.goal tbody td.hoy {
	font-family: inherit;
	font-size: inherit;
	font-weight: 600;
}

/* Desglose por cliente */

.clients {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client h3 {
	font-size: 1.125rem;
	font-weight: 700;
	margin: 0 0 10px;
}

.client td {
	color: var(--muted);
}

/* Columnas que más se consultan (Hoy en clientes, Horas/día en objetivos): van primero y destacadas */
.dash .hoy {
	background: var(--accent-tint);
	padding-right: 12px;
	padding-left: 12px;
	border-top-color: var(--accent-soft);
}

.dash thead .hoy {
	border-radius: 8px 8px 0 0;
	color: var(--accent-ink);
	font-weight: 600;
}

.dash tbody tr:last-child .hoy {
	border-radius: 0 0 8px 8px;
}

.dash td.hoy {
	font-family: "Bricolage Grotesque", "Figtree", sans-serif;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--accent-ink);
}

.client .note {
	margin: 12px 0 0;
	font-size: 0.875rem;
	color: var(--min);
}

/* Total del mes por proyecto */

.ranking td {
	vertical-align: top;
}

.ranking td:first-child {
	white-space: normal;
	width: 100%;
}

.ranking td:last-child {
	font-weight: 600;
}

.ranking .empty {
	margin: 0;
	color: var(--muted);
}

/* barra proporcional al proyecto con más ingresos */
.ranking .bar {
	display: block;
	height: 4px;
	margin-top: 6px;
	border-radius: 2px;
	background: var(--accent);
}

@media (max-width: 900px) {
	.goals,
	.clients {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 600px) {
	:root {
		--gutter: 12px;
		--pad: 16px;
	}

	body:has(.dash) > header img {
		height: 24px;
	}

	body:has(.dash) > header .btn {
		padding: 4px 10px;
		font-size: 0.875rem;
	}

	.dash {
		font-size: 0.9375rem;
	}

	.dash h2 {
		font-size: 1rem;
		margin: 28px 0 10px;
	}

	.dash table {
		font-size: 0.875rem;
	}

	.hero-top {
		gap: 14px;
	}

	.hero-period,
	.hero-sub {
		font-size: 0.875rem;
	}

	.today dd {
		font-size: 1.25rem;
	}

	.progress-wrap {
		margin-top: 20px;
		padding-bottom: 30px;
	}

	.tick-label {
		font-size: 0.75rem;
	}

	.tick-label .long {
		display: none;
	}

	.tick-label .short {
		display: inline;
	}

	.goal h3 {
		font-size: 0.875rem;
	}

	.goal .figure {
		font-size: 1.625rem;
	}

	.goal .per-day {
		font-size: 0.875rem;
		margin-bottom: 10px;
	}

	.client h3 {
		font-size: 1rem;
	}

	.dash td.hoy {
		font-size: 1.125rem;
	}

	.dash th,
	.dash td {
		padding-left: 8px;
	}

	.dash .hoy {
		padding-right: 8px;
	}
}
