@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f4f6f5;
  color: #1a2e2e;
  margin: 0;
}
h1, h2, h3, .brand { font-family: 'Poppins', 'Inter', sans-serif; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  padding: 32px;
}
.login-card { width: 340px; text-align: center; }
.login-card h1 { color: #0f766e; font-size: 1.5em; margin-bottom: 4px; }
.login-card p { color: #667; margin-bottom: 24px; }
.error-msg { color: #dc2626; font-size: 0.9em; margin-top: 16px; }

header {
  background: linear-gradient(135deg, #0e4a4a, #115e59 60%, #0f766e);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 1.2em; margin: 0; letter-spacing: 0.2px; }
header .user { font-size: 0.85em; opacity: 0.9; }
header button {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}
header button:hover { background: rgba(255,255,255,0.22); }

nav.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  background: #fff;
  border-bottom: 1px solid #e2e8e4;
  overflow-x: auto;
}
nav.tabs button {
  border: none;
  background: none;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.95em;
  color: #667;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
nav.tabs button.active { color: #0f766e; border-bottom-color: #0f766e; font-weight: 600; }

main { padding: 24px; max-width: 1500px; margin: 0 auto; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.btn {
  background: #0f766e; color: #fff; border: none; border-radius: 8px;
  padding: 10px 16px; cursor: pointer; font-size: 0.9em; font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { box-shadow: 0 4px 14px rgba(15,118,110,0.28); transform: translateY(-1px); }
.btn.secondary { background: #e2e8e4; color: #0e4a4a; }
.btn.secondary:hover { box-shadow: none; transform: none; background: #d7ded9; }
.btn.danger { background: #dc2626; }

.estado-badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 0.82em; font-weight: 600; white-space: nowrap;
}
.estado-badge.agendado { background: #dbeafe; color: #1d4ed8; }
.estado-badge.completado { background: #dcfce7; color: #15803d; }
.estado-badge.cancelado { background: #fee2e2; color: #b91c1c; }
.estado-badge.no-asistio { background: #fef3c7; color: #b45309; }

.score-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 100px;
  font-size: 0.78em; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.score-badge.score-nuevo { background: #e0e7ff; color: #4338ca; }
.score-badge.score-ok { background: #dcfce7; color: #15803d; }
.score-badge.score-warn { background: #fef3c7; color: #b45309; }
.score-badge.score-risk { background: #fee2e2; color: #b91c1c; }

tr.turno-resuelto { opacity: 0.6; }
tr.turno-resuelto:hover { opacity: 1; }

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

.metric-card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 1px 8px rgba(0,0,0,0.06); }
.metric-card .value { font-size: 1.7em; font-weight: 800; color: #0f766e; font-family: 'Poppins', sans-serif; }
.metric-card .label { font-size: 0.8em; color: #667; margin-top: 2px; }
.metric-card.accent {
  background: linear-gradient(135deg, #0e4a4a, #0f766e);
  color: #fff;
}
.metric-card.accent .value { color: #fff; }
.metric-card.accent .label { color: #d5ece6; }

.servicio-card, .lote-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,0.06); transition: box-shadow 0.15s ease; }
.servicio-card:hover, .lote-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.servicio-card .thumb, .lote-card .thumb { height: 150px; background: #e2e8e4 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #99a; font-size: 0.85em; }
.servicio-card .body, .lote-card .body { padding: 14px; }
.servicio-card h3, .lote-card h3 { margin: 0 0 6px; font-size: 1.05em; }
.servicio-card .meta, .lote-card .meta { font-size: 0.85em; color: #667; margin-bottom: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75em; font-weight: 600; }
.badge.activo { background: #ccfbf1; color: #0f766e; }
.badge.inactivo { background: #f1f5f4; color: #667; }
.badge.nuevo { background: #fef3c7; color: #b45309; }
.servicio-card .actions, .lote-card .actions { display: flex; gap: 8px; margin-top: 10px; }
.servicio-card .actions button, .lote-card .actions button { flex: 1; font-size: 0.8em; padding: 6px; }

.table-wrap { overflow-x: auto; border-radius: 10px; background: #fff; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef1ef; font-size: 0.84em; word-wrap: break-word; }
th { background: #f0f4f1; color: #445; white-space: nowrap; }
td.col-truncar { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.col-acciones { white-space: normal; }
td.col-acciones .btn { padding: 5px 8px; font-size: 0.85em; margin: 2px 0; display: block; width: 100%; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 480px; max-width: 92vw; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 0.85em; color: #556; margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #d7ded9; border-radius: 8px; font-size: 0.9em;
}
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fotos-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.fotos-list .foto-item { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; }
.fotos-list img { width: 100%; height: 100%; object-fit: cover; }
.fotos-list .rm { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
