/* Fichaje Geo — app del empleado. Grilla de 4/8 px. */
:root {
	--bg: #f6f7f9;
	--surface: #ffffff;
	--text: #14181f;
	--muted: #5b6472;
	--border: #e3e6eb;
	--primary: #0f6e5c;
	--primary-strong: #0b5546;
	--out: #b4410f;
	--out-strong: #8f340c;
	--ok-bg: #e7f5ef;
	--ok-text: #0b5546;
	--warn-bg: #fff4e0;
	--warn-text: #7a4a00;
	--err-bg: #fdecec;
	--err-text: #9b1c1c;
	--radius: 16px;
	--shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	--shadow-punch: 0 12px 32px rgba(15, 110, 92, 0.28);
	color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
	background: var(--bg);
	color: var(--text);
	font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

.app {
	max-width: 480px;
	min-height: 100dvh;
	margin: 0 auto;
	padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.app__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 24px;
}

.app__brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.app__logo {
	display: block;
	max-height: 44px;
	max-width: 140px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.app__brand-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--primary);
}

.app__net {
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--warn-bg);
	color: var(--warn-text);
	font-size: 13px;
	font-weight: 600;
}

.view__title {
	margin: 0 0 16px;
	font-size: 26px;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

/* Formularios */
.form { display: grid; gap: 16px; }

.field { display: grid; gap: 8px; }

.field__label { font-size: 14px; font-weight: 600; color: var(--muted); }

.field__input {
	width: 100%;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	font: inherit;
	font-size: 20px;
	letter-spacing: 0.04em;
	transition: all 0.2s ease;
}

.field__input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 4px rgba(15, 110, 92, 0.15);
}

.form__error { min-height: 24px; margin: 0; color: var(--err-text); font-size: 14px; }

/* Botones */
.btn {
	display: block;
	width: 100%;
	padding: 16px;
	border: 0;
	border-radius: 12px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn--primary:active { transform: scale(0.98); }

.btn--ghost { margin-top: 8px; background: transparent; color: var(--muted); }

.btn--small { margin-top: 32px; padding: 12px; font-size: 14px; font-weight: 600; }

.consent__text {
	margin: 0 0 24px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--muted);
	font-size: 15px;
	white-space: pre-line;
}

/* Pantalla principal: todo entra en una pantalla; si hay muchas fichadas, la lista se desplaza sola. */
.app:has(#view-main:not([hidden])) {
	display: flex;
	flex-direction: column;
	height: 100dvh;
	min-height: 0;
	padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.app:has(#view-main:not([hidden])) .app__header { margin-bottom: 12px; }
.app:has(#view-main:not([hidden])) .app__logo { max-height: 36px; }

.view--main:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.main__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hello { margin: 0; color: var(--muted); font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hello strong { color: var(--text); }

.logout {
	flex: none;
	min-height: 44px;
	margin-right: -8px;
	padding: 0 8px;
	border: 0;
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.clock {
	margin: 0;
	font-size: clamp(36px, 6svh, 48px);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
}

.status { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.4; }

.turnos { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.turnos li {
	display: flex;
	gap: 8px;
	align-items: baseline;
	min-width: 0;
	font-size: 14px;
	color: var(--muted);
	white-space: nowrap;
}
.turnos li span { overflow: hidden; text-overflow: ellipsis; }
.turnos strong { color: var(--text); font-variant-numeric: tabular-nums; }
.turnos li::before { content: 'Tu horario'; flex: none; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.punch {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 100%;
	height: clamp(88px, 15svh, 128px);
	margin-top: 16px;
	padding: 12px 16px;
	border: 0;
	border-radius: 20px;
	background: var(--primary);
	color: #fff;
	box-shadow: var(--shadow-punch);
	font: inherit;
	cursor: pointer;
	transition: all 0.2s ease;
}

.punch:active { transform: scale(0.98); }
.punch:disabled { opacity: 0.85; cursor: progress; }
.punch:focus-visible { outline: 4px solid rgba(15, 110, 92, 0.35); outline-offset: 4px; }

.punch--out { background: var(--out); box-shadow: 0 8px 24px rgba(180, 65, 15, 0.25); }
.punch.punch--wait { background: #5f6b76; box-shadow: none; opacity: 1; cursor: not-allowed; }
.punch.punch--wait:disabled .punch__hint::before { content: none; display: none; }
.punch.punch--wait:hover, .punch.punch--wait:active { background: #5f6b76; transform: none; }

.punch__label { font-size: 24px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
.punch__hint { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; opacity: 0.92; }

.punch:disabled .punch__hint::before {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-right: 8px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	vertical-align: -1px;
	animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.result, .queue {
	flex: none;
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
}

.result--ok { background: var(--ok-bg); color: var(--ok-text); }
.result--warn, .queue { background: var(--warn-bg); color: var(--warn-text); }
.result--error { background: var(--err-bg); color: var(--err-text); }

/* Lista del día */
.list__title {
	flex: none;
	margin: 16px 0 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
}

.list {
	flex: 0 1 auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
	overflow-y: auto;
	overscroll-behavior: contain;
	align-self: stretch;
}
.list:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.list__item, .list__empty {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 8px 14px;
	border-top: 1px solid var(--border);
}

.list__item:first-child, .list__empty:first-child { border-top: 0; }
.list__empty { display: flex; color: var(--muted); }

.list__time { font-weight: 700; font-variant-numeric: tabular-nums; }
.list__what { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list__badge {
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	background: var(--ok-bg);
	color: var(--ok-text);
}

.list__item--revisar .list__badge, .list__item--pendiente .list__badge { background: var(--warn-bg); color: var(--warn-text); }
.list__item--rechazada .list__badge { background: var(--err-bg); color: var(--err-text); }

/* Elegir sede */
.sede-list { display: grid; gap: 8px; margin: 24px 0 8px; }
.sede-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	min-height: 56px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	text-align: left;
	box-shadow: var(--shadow);
	cursor: pointer;
	transition: all 0.2s ease;
}
.sede-option:active { transform: scale(0.98); border-color: var(--primary); }
.sede-option:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.sede-option:disabled { opacity: 0.6; }
.sede-option__name { font-weight: 700; font-size: 17px; }
.sede-option__dist { color: var(--muted); font-size: 14px; white-space: nowrap; }

.steps { padding-left: 20px; margin: 16px 0 24px; display: grid; gap: 12px; color: var(--muted); }
.steps strong { color: var(--text); }

/* En pantallas táctiles el :hover queda pegado después de tocar: sólo con mouse. */
@media (hover: hover) {
	.sede-option:hover { border-color: var(--primary); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); }
	.btn--primary:hover { background: var(--primary-strong); }
	.btn--ghost:hover { color: var(--text); }
	.punch:hover { background: var(--primary-strong); }
	.punch--out:hover { background: var(--out-strong); }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before { transition: none !important; animation: none !important; }
}
