/* ---------- Base: móvil primero, fondo oscuro, área segura ---------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}
html {
	-webkit-text-size-adjust: 100%;
}
body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.4;
	color: #ecedee;
	background: #111214;
	padding-left: env(safe-area-inset-left);
	padding-right: env(safe-area-inset-right);
	-webkit-tap-highlight-color: transparent;
}
[hidden] {
	display: none !important;
}
/* Botones: se respetan tal cual están escritos, sin mayúsculas forzadas. */
button,
input,
select,
textarea {
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
}
button {
	cursor: pointer;
}
button:disabled {
	cursor: default;
}
a {
	color: #6cb4ff;
}

.tc-boton {
	min-height: 44px;
	padding: 10px 16px;
	font-size: 15px;
	color: #ecedee;
	background: transparent;
	border: 1px solid #3a3b40;
	border-radius: 10px;
}
.tc-boton:disabled {
	opacity: .5;
}
.tc-boton-primario {
	color: #000;
	background: #f0b90b;
	border-color: #f0b90b;
	font-weight: 600;
}
.tc-boton-peligro {
	color: #fff;
	background: #c93c40;
	border-color: #c93c40;
}

.tc-campo {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
}
.tc-campo > span {
	font-weight: 600;
	opacity: .85;
}
.tc-campo input,
.tc-campo select,
.tc-campo textarea {
	width: 100%;
	min-height: 44px;
	padding: 9px 11px;
	font-size: 16px; /* 16px evita el zoom automático de iOS al enfocar */
	color: #ecedee;
	background: #1c1d21;
	border: 1px solid #3a3b40;
	border-radius: 9px;
}
.tc-campo textarea {
	resize: vertical;
}

/* ---------- Login ---------- */
.tc-login {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	min-height: 100dvh;
	padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.tc-login-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: 100%;
	max-width: 360px;
}
.tc-login-logo {
	align-self: center;
	border-radius: 18px;
}
.tc-login-titulo {
	margin: 0 0 6px;
	font-size: 22px;
	text-align: center;
}
.tc-login-entrar {
	min-height: 52px;
	margin-top: 6px;
	font-size: 17px;
}
.tc-login-mensaje {
	padding: 10px 12px;
	font-size: 14px;
	color: #ffb4b4;
	background: rgba(229, 72, 77, .15);
	border: 1px solid rgba(229, 72, 77, .4);
	border-radius: 9px;
}

/* ---------- Encabezado ---------- */
.tc-encabezado {
	position: sticky;
	top: 0;
	z-index: 50;
	padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
	background: rgba(17, 18, 20, .96);
	border-bottom: 1px solid #25262b;
	backdrop-filter: blur(6px);
}
.tc-encabezado-fila {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 720px;
	margin: 0 auto;
}
.tc-encabezado-usuario {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}
.tc-encabezado-nombre {
	font-size: 13px;
	opacity: .75;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tc-encabezado-empresa {
	font-size: 16px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tc-encabezado-selector {
	max-width: 100%;
	min-height: 40px;
	margin-top: 2px;
	padding: 6px 10px;
	font-size: 16px;
	font-weight: 600;
	color: #ecedee;
	background: #1c1d21;
	border: 1px solid #3a3b40;
	border-radius: 9px;
}
.tc-boton-salir {
	flex: none;
	min-height: 40px;
	padding: 8px 14px;
}
.tc-nav {
	display: flex;
	gap: 6px;
	max-width: 720px;
	margin: 8px auto 0;
}
.tc-nav-boton {
	flex: 1;
	min-height: 40px;
	padding: 6px 8px;
	font-size: 14px;
	color: #ecedee;
	background: #1c1d21;
	border: 1px solid #2c2d32;
	border-radius: 9px;
}
.tc-nav-boton[aria-current="page"] {
	color: #000;
	font-weight: 600;
	background: #f0b90b;
	border-color: #f0b90b;
}

/* ---------- Contenido ---------- */
.tc-contenido {
	max-width: 720px;
	margin: 0 auto;
	padding: 14px 12px calc(28px + env(safe-area-inset-bottom));
}
.tc-acciones {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	text-align: center;
}
.tc-boton-grabar {
	min-height: 72px;
	padding: 18px 24px;
	font-size: 20px;
	font-weight: 700;
	color: #000;
	background: #f0b90b;
	border: none;
	border-radius: 14px;
}
.tc-boton-grabar:active {
	transform: scale(.99);
}
.tc-boton-manual {
	align-self: center;
	padding: 8px 18px;
	font-size: 14px;
}
.tc-aviso {
	min-height: 1.4em;
	font-size: 15px;
}
.tc-aviso.tc-aviso-error {
	color: #ff8f8f;
}

/* ---------- Lista y paginación ---------- */
.tc-lista {
	margin-top: 14px;
}
.tc-lista-tarjetas {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.tc-lista-estado {
	margin: 10px 0;
	font-size: 14px;
	text-align: center;
	opacity: .85;
}
.tc-lista-estado:empty {
	display: none;
}
.tc-lista-estado.tc-lista-error {
	color: #ff8f8f;
	opacity: 1;
}
.tc-lista-paginacion {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
}
.tc-lista-paginacion:empty {
	display: none;
}
.tc-lista-boton {
	min-height: 44px;
	padding: 10px 16px;
	font-size: 14px;
	color: #000;
	background: #f0b90b;
	border: none;
	border-radius: 8px;
}
.tc-lista-boton:disabled {
	opacity: .35;
}
.tc-lista-pagina {
	font-size: 14px;
}

/* ---------- Tarjeta (igual a la aprobada: tinte, franja de 4px, etiqueta de estado) ---------- */
.tc-tarjeta {
	min-width: 0;
	padding: 12px 14px;
	color: #1f2328;
	background: linear-gradient(var(--tc-estado-tinte, transparent), var(--tc-estado-tinte, transparent)) #fff;
	border: 1px solid #e4e4e7;
	border-left: 4px solid var(--tc-estado-color, #ccc);
	border-radius: 12px;
	overflow-wrap: anywhere;
	transition: background-color .4s, box-shadow .4s, opacity .2s;
}
.tc-tarjeta * {
	color: #1f2328;
}
.tc-tarjeta-nueva {
	box-shadow: 0 0 0 3px #2e9d4a;
}
.tc-tarjeta-cancelada {
	opacity: .6;
}
.tc-tarjeta-encabezado {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 8px;
	margin-bottom: 10px;
}
.tc-tarjeta-id {
	font-weight: 700;
	font-size: 15px;
}
.tc-tarjeta-chip-estado {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 8px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
	background: var(--tc-estado-fondo);
	border-radius: 999px;
}
.tc-tarjeta-chip-estado-punto {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--tc-estado-color);
}
.tc-tarjeta .tc-tarjeta-transcurrido {
	font-size: 12px;
	font-weight: 600;
	color: #8a5a00;
	white-space: nowrap;
}
.tc-tarjeta-encabezado-derecha {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}
.tc-tarjeta .tc-tarjeta-fecha {
	font-size: 12px;
	color: #6b6f76;
	white-space: nowrap;
}
.tc-tarjeta-editar {
	margin: 0;
	min-height: 30px;
	padding: 3px 10px;
	font-size: 12px;
	line-height: 1.4;
	background: rgba(255, 255, 255, .7);
	border: 1px solid #cfcfd4;
	border-radius: 6px;
}
.tc-tarjeta .tc-tarjeta-empresa {
	display: inline-block;
	margin: -4px 0 8px;
	padding: 1px 8px;
	font-size: 12px;
	font-weight: 600;
	color: #3a3b40;
	background: rgba(0, 0, 0, .06);
	border-radius: 6px;
}
.tc-tarjeta .tc-tarjeta-hora {
	display: inline-block;
	margin-bottom: 8px;
	padding: 3px 10px;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	background: #1f2328;
	border-radius: 7px;
}
.tc-tarjeta .tc-tarjeta-rotulo {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: #6b6f76;
}
.tc-tarjeta-origen {
	margin-bottom: 6px;
}
.tc-tarjeta-direccion {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}
.tc-tarjeta-cliente {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	margin-bottom: 8px;
	font-size: 14px;
}
.tc-tarjeta-cliente-nombre {
	font-weight: 600;
}
.tc-tarjeta a.tc-tarjeta-telefono {
	color: #1f6feb;
	text-decoration: none;
	white-space: nowrap;
}
.tc-tarjeta-etiquetas {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 8px;
}
.tc-tarjeta-chofer,
.tc-tarjeta-monto {
	padding: 3px 9px;
	font-size: 13px;
	font-weight: 600;
	background: rgba(255, 255, 255, .8);
	border: 1px solid #e4e4e7;
	border-radius: 6px;
}
.tc-tarjeta .tc-tarjeta-asignado {
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 700;
	color: #1d6b45;
}
.tc-tarjeta-destino {
	margin-bottom: 8px;
	font-size: 14px;
}
.tc-tarjeta-notas {
	margin-bottom: 8px;
	padding: 8px 10px;
	font-size: 13px;
	line-height: 1.45;
	white-space: pre-wrap;
	background: rgba(255, 255, 255, .7);
	border: 1px solid #ececef;
	border-radius: 8px;
}
.tc-tarjeta-transcripcion {
	margin-bottom: 8px;
	font-size: 13px;
}
.tc-tarjeta .tc-tarjeta-transcripcion summary {
	cursor: pointer;
	color: #1f6feb;
}
.tc-tarjeta .tc-tarjeta-transcripcion p {
	margin: 6px 0 0;
	padding: 8px;
	color: #444;
	white-space: pre-wrap;
	background: #f1f1f3;
	border-radius: 8px;
}
.tc-tarjeta .tc-tarjeta-error {
	margin: 0 0 8px;
	padding: 6px 8px;
	font-size: 13px;
	color: #c0392b;
	background: #fdecea;
	border-radius: 6px;
}
.tc-tarjeta-pie {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid rgba(0, 0, 0, .06);
}

/* ---------- Selector de quién hizo el viaje ---------- */
.tc-drivers {
	margin-top: 10px;
	padding: 10px;
	background: rgba(48, 164, 108, .1);
	border: 1px solid rgba(48, 164, 108, .45);
	border-radius: 10px;
}
.tc-drivers-titulo {
	margin-bottom: 8px;
	font-size: 13px;
	font-weight: 700;
}
.tc-drivers-opciones {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.tc-drivers-opcion {
	min-width: 56px;
	min-height: 44px;
	padding: 8px 14px;
	font-size: 16px;
	font-weight: 700;
	color: #1f2328;
	background: #fff;
	border: 1px solid #b9d9c7;
	border-radius: 10px;
}
.tc-drivers-opcion.tc-drivers-activo {
	color: #fff;
	background: #30a46c;
	border-color: #30a46c;
}
.tc-drivers-opcion.tc-drivers-activo * {
	color: #fff;
}

/* ---------- Selector de estado (4 botones) ---------- */
.tc-estados {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 5px;
}
.tc-estados-opcion {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-width: 0;
	min-height: 40px;
	margin: 0;
	padding: 4px 3px;
	font-size: 12px;
	line-height: 1.15;
	color: #1f2328;
	background: #fff;
	border: 1px solid #dcdce0;
	border-radius: 7px;
}
.tc-estados-etiqueta {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tc-estados-punto {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--tc-estado-color);
}
.tc-estados-opcion.tc-estados-activo {
	font-weight: 600;
	background: var(--tc-estado-fondo);
	border-color: var(--tc-estado-color);
	box-shadow: inset 0 0 0 1px var(--tc-estado-color);
}
.tc-estados-opcion:disabled {
	opacity: .6;
	cursor: wait;
}
/* Pantallas angostas: el punto va arriba de la etiqueta para que "Completado" entre en una fila. */
@media (max-width: 420px) {
	.tc-estados-opcion {
		flex-direction: column;
		gap: 3px;
		padding: 4px 2px;
	}
}

/* ---------- Formulario de servicio ---------- */
.tc-formulario {
	margin-top: 16px;
	padding: 16px;
	color: #333;
	background: #fafafa;
	border: 1px solid #ddd;
	border-radius: 12px;
	scroll-margin-top: 120px;
}
.tc-formulario * {
	color: #333;
}
.tc-formulario-titulo {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
}
.tc-formulario-aviso {
	margin: 0 0 12px;
	padding: 10px 12px;
	font-size: 14px;
	line-height: 1.4;
	background: #fff6dc;
	border: 1px solid #f3dc9b;
	border-radius: 8px;
}
.tc-formulario .tc-formulario-aviso {
	color: #6b4e00;
}
.tc-campos {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.tc-campo-ancho {
	grid-column: 1 / -1;
}
.tc-formulario .tc-campo input,
.tc-formulario .tc-campo textarea {
	color: #222;
	background: #fff;
	border-color: #ccc;
}
.tc-formulario .tc-campo .tc-transcripcion {
	color: #555;
	background: #eee;
}
.tc-formulario .tc-campo-estado {
	margin-top: 16px;
}
.tc-formulario .tc-estados {
	gap: 8px;
}
.tc-formulario .tc-estados-opcion {
	gap: 6px;
	padding: 9px 8px;
	font-size: 14px;
	border-color: #ccc;
	border-radius: 8px;
}
.tc-botones {
	display: flex;
	gap: 12px;
	margin-top: 16px;
}
.tc-boton-guardar {
	flex: 1;
	min-height: 52px;
	padding: 14px 16px;
	font-size: 16px;
	font-weight: 600;
	background: #2e9d4a;
	border: none;
	border-radius: 10px;
}
.tc-formulario .tc-boton-guardar {
	color: #fff;
}
.tc-boton-cerrar {
	flex: none;
	min-height: 52px;
	padding: 14px 18px;
	font-size: 15px;
	background: transparent;
	border: 1px solid #ccc;
	border-radius: 10px;
}
.tc-formulario .tc-boton-cerrar {
	color: #555;
}
.tc-boton-guardar:disabled,
.tc-boton-cerrar:disabled {
	opacity: .6;
}
.tc-formulario-mensaje {
	margin-top: 12px;
	font-size: 14px;
	text-align: center;
}
.tc-formulario .tc-formulario-mensaje.tc-error {
	color: #c0392b;
}
@media (max-width: 480px) {
	.tc-campos {
		grid-template-columns: 1fr;
	}
	.tc-formulario .tc-estados {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ---------- Capa de grabación ---------- */
.tc-capa {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
	background: rgba(17, 18, 20, .8);
}
.tc-capa-tarjeta {
	width: 100%;
	max-width: 360px;
	padding: 28px 22px 20px;
	text-align: center;
	color: #1f2328;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}
.tc-capa-tarjeta * {
	color: #1f2328;
}
.tc-capa-punto {
	display: inline-block;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #e5484d;
	animation: tc-pulso 1.4s ease-in-out infinite;
}
@keyframes tc-pulso {
	0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 72, 77, .45); }
	50% { transform: scale(1.12); box-shadow: 0 0 0 10px rgba(229, 72, 77, 0); }
}
.tc-capa-titulo {
	margin-top: 10px;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
}
.tc-capa-contador {
	margin: 6px 0 0;
	font-size: 44px;
	font-weight: 700;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}
.tc-capa .tc-capa-ayuda {
	margin: 8px 0 22px;
	font-size: 14px;
	color: #6b6f76;
}
.tc-capa-detener {
	display: block;
	width: 100%;
	min-height: 56px;
	padding: 14px 16px;
	font-size: 18px;
	font-weight: 600;
	background: #e5484d;
	border: none;
	border-radius: 12px;
}
.tc-capa .tc-capa-detener {
	color: #fff;
}
.tc-capa-cancelar {
	display: block;
	width: 100%;
	min-height: 44px;
	margin-top: 10px;
	padding: 10px 16px;
	font-size: 15px;
	background: transparent;
	border: 1px solid #d4d4d8;
	border-radius: 12px;
}
.tc-capa .tc-capa-cancelar {
	color: #555;
}
.tc-capa-cargando {
	display: inline-block;
	width: 34px;
	height: 34px;
	border: 4px solid #e4e4e7;
	border-top-color: #1f2328;
	border-radius: 50%;
	animation: tc-girar .9s linear infinite;
}
@keyframes tc-girar {
	to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
	.tc-capa-punto,
	.tc-capa-cargando {
		animation: none;
	}
}

/* ---------- Vistas de admin ---------- */
.tc-admin-titulo {
	margin: 4px 0 12px;
	font-size: 20px;
}
.tc-admin-panel {
	margin-bottom: 16px;
	padding: 14px;
	background: #1a1b1f;
	border: 1px solid #2c2d32;
	border-radius: 12px;
}
.tc-admin-panel h3 {
	margin: 0 0 10px;
	font-size: 16px;
}
.tc-admin-form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.tc-admin-form .tc-boton {
	grid-column: 1 / -1;
}
.tc-admin-mensaje {
	grid-column: 1 / -1;
	min-height: 1.2em;
	font-size: 14px;
}
.tc-admin-fila > .tc-admin-mensaje:empty {
	display: none;
}
.tc-admin-mensaje.tc-error {
	color: #ff8f8f;
}
.tc-admin-mensaje.tc-exito {
	color: #7fd6a4;
}
.tc-admin-lista {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.tc-admin-fila {
	padding: 12px 14px;
	background: #1a1b1f;
	border: 1px solid #2c2d32;
	border-radius: 12px;
}
.tc-admin-fila-inactiva {
	opacity: .6;
}
.tc-admin-fila-titulo {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 6px 10px;
	font-weight: 700;
}
.tc-admin-fila-detalle {
	margin-top: 2px;
	font-size: 13px;
	opacity: .8;
}
.tc-admin-etiqueta {
	padding: 1px 8px;
	font-size: 12px;
	font-weight: 600;
	background: #2c2d32;
	border-radius: 6px;
}
.tc-admin-etiqueta-activo {
	color: #0b2d1c;
	background: #30a46c;
}
.tc-admin-etiqueta-inactivo {
	color: #fff;
	background: #8b8d98;
}
.tc-admin-acciones {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}
.tc-admin-acciones .tc-boton {
	min-height: 40px;
	padding: 6px 12px;
	font-size: 14px;
}
.tc-admin-edicion {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 10px;
}
.tc-admin-edicion .tc-admin-acciones {
	grid-column: 1 / -1;
	margin-top: 0;
}
@media (max-width: 480px) {
	.tc-admin-form,
	.tc-admin-edicion {
		grid-template-columns: 1fr;
	}
}

/* ---------- Escritorio ---------- */
@media (min-width: 900px) {
	.tc-acciones {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
	}
	.tc-boton-grabar {
		flex: 1;
	}
	.tc-boton-manual {
		align-self: center;
	}
	.tc-aviso {
		flex-basis: 100%;
	}
}
